Join our Discord Server
Getting Started

Lab 20: The ‘Kill’ Command

Estimated reading: 1 minute 102 views

Verify if the kill command kills all the container started by the docker-compose and verify if there is any running container after killing it.

Pre-requisite:

Tested Infrastructure

Platform Number of Instance Reading Time
Play with Docker 1 5 min

Pre-requisite

  • Create an account with DockerHub
  • Open PWD Platform on your browser
  • Click on Add New Instance on the left side of the screen to bring up Alpine OS instance on the right side

Initial setup

$ mkdir app
$ cd app

Create a docker-compose.yml file

version: '3.1'
services:
   webserver:
     image: nginx:alpine
     expose:
       - "80"
   loadbalancer:
     image: nginx:alpine
     volumes:
       - ./nginx.conf:/etc/nginx/nginx.conf:ro
     depends_on:
       - webserver
     ports:
       - "80:4000"

Create the compose containers

$ docker-compose up -d --scale webserver=3

View the containers

$ docker-compose ps

Kill all the containers

$ docker-compose kill

Check if there are any running containers

$ docker-compose ps
Share this Doc

Lab 20: The ‘Kill’ Command

Or copy link

CONTENTS
Join our Discord Server