a series of instruction • A container is the executable instance, result such instructions • Images can be extended BASE_IMAGE IMAGE_ONE IMAGE_TWO FROM utnaf/BASE_IMAGE FROM utnaf/IMAGE_ONE
RUN npm install COPY . ./ EXPOSE 3000 CMD ["npm", "start"] Starting image Set the base workdir Copy the files for dependencies installation Install dependencies
RUN npm install COPY . ./ EXPOSE 3000 CMD ["npm", "start"] Starting image Set the base workdir Copy the files for dependencies installation Install dependencies Copy the rest of the files
RUN npm install COPY . ./ EXPOSE 3000 CMD ["npm", "start"] Starting image Set the base workdir Copy the files for dependencies installation Install dependencies Copy the rest of the files Expose the port that the app is listening to
RUN npm install COPY . ./ EXPOSE 3000 CMD ["npm", "start"] Starting image Set the base workdir Copy the files for dependencies installation Install dependencies Copy the rest of the files Expose the port that the app is listening to Entrypoint command
RUN npm install COPY . ./ EXPOSE 3000 CMD ["npm", "start"] Starting image Set the base workdir Copy the files for dependencies installation Install dependencies Copy the rest of the files Expose the port that the app is listening to Entrypoint command docker build --tag my-image:1.0.0 . docker run -p "3000:3000" my-image:1.0.0
docker-compose up -d # start the container in detached mode docker-compose stop # stop the containers docker-compose down # stop **and remove** the containers # debug containers docker-compose logs # print the last logs docker-compose logs -f # print logs in follow mode docker-compose logs [container] # print the logs of the specified container docker-compose exec [container] [command] # run the command in the container docker-compose exec myApp bash # enter a bash session on the myApp container docker-compose ps # show the current status of the containers
docker-compose up -d # start the container in detached mode docker-compose stop # stop the containers docker-compose down # stop **and remove** the containers # debug containers docker-compose logs # print the last logs docker-compose logs -f # print logs in follow mode docker-compose logs [container] # print the logs of the specified container docker-compose exec [container] [command] # run the command in the container docker-compose exec myApp bash # enter a bash session on the myApp container docker-compose ps # show the current status of the containers Available on docker command as well