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.

    command: bash -c "cd /code; chmod +x ./deploy/; ./deploy/;"
    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:

  • Why doesn't docker accept non-local MAC addresses?
  • Not able to connect mongodb with Rails container using Docker compose
  • How does Docker share resources
  • Docker: readonly filesystem error
  • docker compose backup bitnami redmine volume
  • Nginx service on Docker giving better performance on 1GB RAM Node than 4GB RAM Node
  • 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:

        command: bash -c "cd /code; chmod +x ./deploy/; ./deploy/;"
            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?

  • How to scale a NodeJS stateful application
  • local files missing from docker-machine container
  • Provide only GRANT EXECUTE 'procedure' to a user (No select or insert permissions)
  • Docker stopping after first line
  • create-react-app + docker = QA and PROD Deploy
  • spinning up multiple jenkins docker slaves for a single job
  • 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"]

    In your docker-compose.yaml file, add the following parameter (under the ‘container’ section):

    tty: true
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.