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.

Installing Docker Compose:

    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

Popular Posts on this blog

Apache Webserver - Installation from source (tar.gz and tar.bz2)

Setting up a Mail server using Roundcube - Part-1 - Centos 7

How to Install LAMP Stack on Linux - Centos 7

Apache Tomcat Installation - Ubuntu - 17.04

Setting up a Mail server using Roundcube - Part-3 - Centos 7

Blog Top Sites

Blog Log