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 - keep running two ways

version: '3.7'
services:
  one:
    build:
        context: .
        dockerfile: Dockerfile1
  two:
    build:
        context: .
        dockerfile: Dockerfile2
    stdin_open: true
    tty: true


FROM centos:7
RUN yum install -y less vim which net-tools
CMD tail -f /dev/null
FROM centos:7
RUN yum install -y less vim which
WORKDIR /opt

attach to either one of them:

docker-compose exec one sh
ping compose1_one_1