Installing Docker-Compose on Ubuntu
On our previous article we saw how to install docker on Ubuntu 17.04. That is suitable for running a individual container(single applications). What if we want to run multi container application?
This leads to the invention of docker-compose, In this article, we will see you how to install the latest version of Docker Compose to help you to manage multi-container applications.
Run the below curl command which will download and install the latest version of docker-compose,
Change the permission of the downloaded file which will make it as an executable one,
Check your installation:
Run the below command to check the version of docker-compose,
Verify your installation:
We can check whether the installation is successful or not by running the docker-compose command,
Running a Container with Docker Compose:
Docker compose will always check for for a YAML file called as docker-compose.yml. To check our installation we will create a directory called hello-world where we going to run the hello-world image.
Create the YAML file for the hello-world image with you favourite text editor,
Paste the below content into docker-compose.yml file,
The first line in the YAML file is used as part of the container name. The second line specifies which image to use to create the container. Likewise we can add more containers with above syntax.
Now run the docker-compose command to run the application,
If your installation is successful you will get the above output.
We've now successfully installed Docker Compose in our system.
Feel free to ask if you have any questions.
Comments