Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Docker compose 1st example

provide command line override for CMD/ENTRYPOINT in the compose yaml file

version: '3.7'
services:
  one:
    build:
        context: .
        dockerfile: Dockerfile
    entrypoint:
        - tail
        - -f
        - /dev/null
  two:
    build:
        context: .
        dockerfile: Dockerfile
    entrypoint: tail -f /dev/null
FROM centos:7
RUN yum install -y less vim which
WORKDIR /opt
cd examples/compose1
docker-compose up
  • This builds the image based on the Dockerfile and then launches two containers