Docker - docker-compose

Card Puncher Data Processing

About

Docker Compose is a powerful tool that enables you to launch multiple Docker images in a coordinated fashion.

Compose is a tool for defining and running multi-container Docker applications.

Compose uses a project name as identifier to isolate environments from each other.

Steps

Using Compose is basically a three-step process.

  • Define your app’s environment with a Dockerfile so it can be reproduced anywhere.
  • Define the services that make up your app in docker-compose.yml so they can be run together in an isolated environment.
  • Lastly, run docker-compose up and Compose will start and run your entire app.

Management

Command

Compose has commands for managing the whole lifecycle of your application:

  • Start, stop and rebuild services
  • View the status of running services
  • Stream the log output of running services
  • Run a one-off command on a service

List

ps (listing and status)
docker-compose ps
Name                              Command               State                            Ports
--------------------------------------------------------------------------------------------------------------------------------------
quickstart_kafka_1                    /etc/confluent/docker/run        Up       0.0.0.0:29092->29092/tcp, 0.0.0.0:9092->9092/tcp
quickstart_ksql-cli_1                 perl -e while(1){ sleep 99 ...   Up
quickstart_ksql-datagen-pageviews_1   bash -c echo Waiting for K ...   Exit 1
quickstart_ksql-datagen-users_1       bash -c echo Waiting for K ...   Exit 1
quickstart_schema-registry_1          /etc/confluent/docker/run        Up       0.0.0.0:8081->8081/tcp
quickstart_zookeeper_1                /etc/confluent/docker/run        Up       2181/tcp, 2888/tcp, 0.0.0.0:32181->32181/tcp, 3888/tcp

image
docker-compose images
top (Process Info and Command )
docker-compose top

See the process information and command

up

docker-compose up -d
# or
docker-compose up -d -f docker-compose.yml
# or
docker stack up -c docker-compose.yml Stack

where:

  • -d is called the Detached mode: Run containers in the background, print new container names.

Configuration can be overwritten by another Docker - docker-compose.yml.

Example:

docker-compose -f docker-compose.yml -f rpm-overides.yml up
  • build before up
 docker-compose up -d --build

down

docker-compose down
Stopping kafkasinglenode_kafka_1     ... done
Stopping kafkasinglenode_zookeeper_1 ... done
Removing kafkasinglenode_kafka_1     ... done
Removing kafkasinglenode_zookeeper_1 ... done

update

docker-compose up

The old container will be removed and the new one will created with the same name.

Configuration

Documentation / Reference





Discover More
Docker For Windows Host Settings
Docker - Installation Docker for Windows on Windows 10

In Windows 10, you install docker with Docker for Windows. The installation provides: Docker Engine, Docker CLI client, Docker Compose Docker Machine, and Kitematic. In the settings...
Toolbox Componentns
Docker - Installation for Windows 7 (Docker Toolbox)

How I have installed and configured Docker in my Windows 7 laptop. The software for windows 7 is called Docker Toolbox. Before version Windows 10: Toolbox:...
Card Puncher Data Processing
Docker - Version (Client and Server - Daemon)

Version of the docker Client and Server (Daemon). See also: for OS and other component version. The host version (called the server)
Card Puncher Data Processing
Docker-Compose - Project

Compose uses a project name to isolate environments from each other. The default project name is based on the name of the directory where the docker-compose.yml is located (ie the basename of the project...
Kafka Commit Log Messaging Process
Kafka - Docker Single Node (Multiple Service Broker + Zookeeper)

Docker Single Node step by step tutorial adapted from the Quickstart documentation. Made: on Windows 7 with Git Bash for Windows...



Share this page:
Follow us:
Task Runner