Popular Certification Courses

LiNUX Lab

Linking Two Containers

Objectives

In this lab, we use Docker commands to create two containers and link them together.

Overview

In this lab, we will put into practice some of the Docker commands that we have learned. Using what we know, we will instantiate a Docker container running MySQL and a Docker container running WordPress. We will then link these containers together, before verifying functionality and ending the lab by stopping and deleting the container instances.

Scenarios

1. Install Docker and configure the service so that it is running.
2. Pull the MySQL Docker container from Docker Hub.
3. Install the MySQL client on the underlying host system (lab server).
4. Instantiate a container from that image, called 'test1-mysql'; check the MySQL documentation from the Docker Hub instance to be sure it is started with the necessary parameters.
5. Verify the container is running using the appropriate Docker commands.
6. Note the IP address of the container using the appropriate Docker commands.
7. Connect to the MySQL container instance via the MySQL client and log in.
8. List the databases in the container using the MySQL client to verify functionality.
9. Create a WordPress Database.
10. Create a WordPress user with full access to the database.
11. Test access to the WordPress user via the MySQL client.
12. Pull the WordPress container from Docker Hub.
13. Instantiate a container from that image, called 'test1-wordpress' and link it to the running MySQL container so it can provide the needed database.
14. Verify the container is running using the appropriate Docker commands.
15. Note the IP address of the container using the appropriate Docker commands.
16. Install a web client on the underlying host system (lab server).
17. Connect to the WordPress instance and install WordPress to the start page.
18. Stop the WordPress container instance and verify it has stopped.
19. Stop the MySQL container instance and verify it has stopped.
20. Delete the WordPress container completely from the host system.
21. Delete the MySQL container completely from the host system.
22. List all stopped containers to verify they have removed.