100-Days-Of-DevOps-Challenge-KodeKloud

Creating a Docker Compose File

The Nautilus application development team shared static website content that needs to be hosted on the httpd web server using a containerised platform. The team has shared details with the DevOps team, and we need to set up an environment according to those guidelines. Below are the details:

Steps

  1. Login into App Server 3
  2. Make sure docker is running and accessible, you can check simply runing:

     docker ps
    
  3. Let’s create the /opt/docker/docker-compose.yml file:

     sudo touch /opt/docker/docker-compose.yml
    
    • Open the file in editor and copy paste the contents from this file
  4. Let’s run the compose file

     docker compose -f /opt/docker/docker-compose.yml up -d
    
  5. Let’s verify if it’s running or not

     docker ps
    

    It should display the output like this:

     banner@stapp03 ~]$ docker ps
     CONTAINER ID   IMAGE          COMMAND              CREATED          STATUS          PORTS                  NAMES
     31c6d90cafa8   httpd:latest   "httpd-foreground"   37 seconds ago   Up 35 seconds   0.0.0.0:3003->80/tcp   httpd
    

Good to Know?

Docker Compose

Compose File Structure

Service Configuration

Compose Commands