Docker compose Building docker image running container

Building docker image and running container using docker-compose


version: ‘3’
build: ../apache2docker/
image: “dockcompose/apache2:1.0”
container_name: dockercomposeapache2
– “3308:80”

FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y openssh-server
RUN mkdir -p /var/run/sshd
RUN mkdir -p /home/dockertest
RUN useradd -d /home/dockertest dockertest
RUN chown dockertest /home/dockertest
RUN echo ‘dockertest:P@$$w0rd’ | chpasswd
RUN sed -i ‘s/PermitRootLogin prohibit-password/PermitRootLogin yes/’ /etc/ssh/sshd_config
CMD [“/usr/sbin/sshd” , “-D”]

Subscribe this channel to get periodic update
Please click this link to subscribe my channel –

Please visit these play lists as well

Docker Fundamentals –
Linux Basics –
Linux Tips and Tricks –
Cloudera Hadoop Administration –
Cloudera Hadoop 6 –
Bash Scripting –
Hortonworks Data Platform3 –
Hadoop Admin Q&A ––i
Hadoop Security –
HD Insight –
HDP Administration –
Cloudera Certified Administrator –
HDP Upgrade –
Puppet –
Data Governance –


4 thoughts on “Docker compose Building docker image running container”
  1. Is it possible to recover the old container which got removed during upgrade ..that upgrade is not successful too

  2. very helpful to understand difference between Dockerfile & docker compose. No where else its explained so nicely as you did. Thanks.

  3. getting warning & error — any clue?
    Successfully tagged dockercompose/discoveryserver:0.0.1-SNAPSHOT

    WARNING: Image for service discoveryserver was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up –build`.

    Recreating 2150e863462a_compose_discoveryserver_1 … error

    ERROR: for discoveryserver no such image: sha256:e792743d82816ba4d2642d097e01c5aa02d8d213ff823aa40428a787cc8cdcb3: No such image: sha256:e792743d82816ba4d2642d097e01c5aa02d8d213ff823aa40428a787cc8cdcb3

    ERROR: The image for the service you're trying to recreate has been removed. If you continue, volume data could be lost. Consider backing up your data before continuing.

Leave a Reply

Your email address will not be published.

Captcha loading...