Docker Compose Version Command

2/12/2022by admin

Reference and guidelines

Default value: Run a Docker Compose command: dockerComposeCommand (Command) (Required) Docker Compose command to execute with the help of arguments. For example, rm to remove all stopped service containers.

There are several versions of the Compose file format – 2, 2.x, and 3.x. The table below provides a snapshot of various versions. For full details on what each version includes and how to upgrade, see About versions and upgrading. This table shows which Compose file versions support specific Docker releases. Compose file format. Docker and Docker-compose installed INTRODUCTION docker-compose is a tool which is used to deploy multi-container application. One single yaml file to deploy your application on the server.Best suited for the developers to setup their workstation in a single command without installing any kind of dependencies for the applicationdocker-compose up to start your application docker-compose down to.

These topics describe the Docker Compose implementation of the Compose format.Docker Compose 1.27.0+ implements the format defined by the Compose Specification. Previous Docker Compose versions have support for several Compose file formats – 2, 2.x, and 3.x. The Compose specification is a unified 2.x and 3.x file format, aggregating properties across these formats.

Compose and Docker compatibility matrix

Compose

There are several versions of the Compose file format – 2, 2.x, and 3.x. Thetable below provides a snapshot of various versions. For full details on what each version includes andhow to upgrade, see About versions and upgrading.

This table shows which Compose file versions support specific Docker releases.

Compose file formatDocker Engine release
Compose specification19.03.0+
3.819.03.0+
3.718.06.0+
3.618.02.0+
3.517.12.0+
3.417.09.0+
3.317.06.0+
3.217.04.0+
3.11.13.1+
3.01.13.0+
2.417.12.0+
2.317.06.0+
2.21.13.0+
2.11.12.0+
2.01.10.0+

In addition to Compose file format versions shown in the table, the Composeitself is on a release schedule, as shown in Composereleases, but file format versionsdo not necessarily increment with each release. For example, Compose file format3.0 was first introduced in Compose release1.10.0, and versionedgradually in subsequent releases.

The latest Compose file format is defined by the Compose Specification and is implemented by Docker Compose 1.27.0+.

Compose documentation

fig, composition, compose, docker
  • Docker Tutorial
  • Docker Useful Resources
Docker
  • Selected Reading

Docker Compose is used to run multiple containers as a single service. For example, suppose you had an application which required NGNIX and MySQL, you could create one file which would start both the containers as a service without the need to start each one separately.

In this chapter, we will see how to get started with Docker Compose. Then, we will look at how to get a simple service with MySQL and NGNIX up and running using Docker Compose.

Docker Compose ─ Installation

The following steps need to be followed to get Docker Compose up and running.

Step 1 − Download the necessary files from github using the following command −

The above command will download the latest version of Docker Compose which at the time of writing this article is 1.10.0-rc2. It will then store it in the directory /home/demo/.

Step 2 − Next, we need to provide execute privileges to the downloaded Docker Compose file, using the following command −

We can then use the following command to see the compose version.

Syntax

Version

Parameters

Docker Compose Version Command List

  • version − This is used to specify that we want the details of the version of Docker Compose.

Output

Compose

The version details of Docker Compose will be displayed.

Example

The following example shows how to get the docker-compose version.

Output

You will then get the following output −

Docker Compose Version Command Prompt

Creating Your First Docker-Compose File

Now let’s go ahead and create our first Docker Compose file. All Docker Compose files are YAML files. You can create one using the vim editor. So execute the following command to create the compose file −

Let’s take a close look at the various details of this file −

  • The database and web keyword are used to define two separate services. One will be running our mysql database and the other will be our nginx web server.

  • The image keyword is used to specify the image from dockerhub for our mysql and nginx containers

  • For the database, we are using the ports keyword to mention the ports that need to be exposed for mysql.

  • And then, we also specify the environment variables for mysql which are required to run mysql.

Now let’s run our Docker Compose file using the following command −

This command will take the docker-compose.yml file in your local directory and start building the containers.

Once executed, all the images will start downloading and the containers will start automatically.

Docker

And when you do a docker ps, you can see that the containers are indeed up and running.

Docker Compose Multiple Commands Version 3


Comments are closed.