Docker Compose


it keeps and reuses the same container unless you remove it with


docker-compose rm


docker-compose up --build

yum install -y net-tools
ifconfig
route -n
ping one


examples/interactive-shell-two/docker-compose.yml
version: '3.7'
services:
  one:
    build:
        context: .
        dockerfile: Dockerfile1
    stdin_open: true
    tty: true
  two:
    image: centos:7
    stdin_open: true
    tty: true

examples/interactive-shell-two/Dockerfile1
FROM centos:7
RUN yum install -y less vim which net-tools


examples/interactive-shell-3/docker-compose.yml
version: '3.7'
services:
  one:
    image: centos:7
    entrypoint:
        - bash
    stdin_open: true
    tty: true
  two:
    image: centos:7
    stdin_open: true
    tty: true