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:

  • How to create docker image for local application taking file and value parameters
  • Docker Swarm creating real cluster: Registered and Removed
  • How to remove docker images based on name?
  • Update a docker image in registry
  • How do I connect a Docker container running in boot2docker to a network service running on another host?
  • When pushing an image in GitLab registry using jenkins, the error fails: Invalid repository name
  • 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?

  • Docker does not set the RAM via docker run command
  • Can I set Neo4j on Docker to import CSV file on the first run, not after that?
  • Is there any limit on pull number in Docker Hub
  • Symfony can't connect to MySQL Docker container
  • Single file volume mounted as directory in Docker
  • Docker container keeps growing
  • 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"]    
    

    to

    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.