Compose not working with Dockerfile using FROM
Right now, I am using a docker-compose file that contains, amongst other stuff, a few lines like this. This executes without any sort of problem. It deploys perfectly and I’m able to access the web server inside through the browser.
container: command: bash -c "cd /code; chmod +x ./deploy/start_dev.sh; ./deploy/start_dev.sh;" image: python:3.6
As I needed to be able to connect to the container through SSH I created a Dockerfile that installs it and modifies the config file so it allows unsafe root connections:
FROM python:3.6 RUN apt-get update && apt-get install openssh-server -y RUN sed -i "s/PermitRootLogin without-password/PermitRootLogin yes/g" /etc/ssh/sshd_config RUN sed -i "s/PermitEmptyPasswords no/PermitEmptyPasswords yes/g" /etc/ssh/sshd_config RUN service ssh restart RUN echo "root:sshpassword" | chpasswd ENTRYPOINT ["/bin/sh", "-c"] CMD ["/bin/bash"]
After that I changed the docker-compose file to:
container: command: bash -c "cd /code; chmod +x ./deploy/start_dev.sh; ./deploy/start_dev.sh;" build: context: .
From this moment on, whenever I run docker-compose up I get the following output:
container exited with code 0
Is there something I am missing?
2 Solutions collect form web for “Compose not working with Dockerfile using FROM”
Solved it switching the last two lines of the Dockerfile
ENTRYPOINT ["/bin/sh", "-c"] CMD ["/bin/bash"]
CMD ["/bin/bash", "-c", "/bin/bash"]
docker-compose.yaml file, add the following parameter (under the ‘container’ section):