Deploy an App on Docker Containers

Task :

The Nautilus Application development team recently finished development of one of the apps that they want to deploy on a containerized platform. The Nautilus Application development and DevOps teams met to discuss some of the basic pre-requisites and requirements to complete the deployment. The team wants to test the deployment on one of the app servers before going live and set up a complete containerized stack using a docker compose fie. Below are the details of the task:

On App Server 2 in Stratos Datacenter create a docker compose file /opt/security/docker-compose.yml (should be named exactly).

The compose should deploy two services (web and DB), and each service should deploy a container as per details below:

For web service:

a. Container name must be php_blog.

b. Use image php with any apache tag. Check here for more details

c. Map php_blog container’s port 80 with host port 8089

d. Map php_blog container’s /var/www/html volume with host volume /var/www/html.

For DB service:

a. Container name must be mysql_blog.

b. Use image mariadb with any tag (preferably latest). Check here for more details

c. Map mysql_blog container’s port 3306 with host port 3306

d. Map mysql_blog container’s /var/lib/mysql volume with host volume /var/lib/mysql.

e. Set MYSQL_DATABASE=database_blog and use any custom user ( except root ) with some complex password for DB connections.

After running docker-compose up you can access the app with curl command curl <server-ip or hostname>:8089/
For more details check here:

Note: Once you click on FINISH button, all currently running/stopped containers will be destroyed and stack will be deployed again using your compose file.


#vi /opt/security/docker-compose.yml

version: "3"

            image: mariadb:latest
            - "3306:3306"
            - /var/lib/mysql:/var/lib/mysql
            restart: always
            container_name: mysql_blog
                MYSQL_ROOT_PASSWORD: steve
                MYSQL_DATABASE: database_blog
                MYSQL_USER: root
                MYSQL_PASSWORD: Am3ric@
            image: php:7.3-apache-stretch
            - "8089:80"
            - /var/www/html:/var/www/html
            container_name: php_blog

# docker-compose up

Note : Ingat untuk file yaml, spasi berpengaruh

Leave a Reply

Your email address will not be published. Required fields are marked *