Skip to content

Houssem-DH/Assigement-1-Multiple-Containers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 

Repository files navigation

Assigement 1: Multiple Containers

First We need To pull nginx , mysql and httpd(apache) repository from docker hub :

sudo docker pull nginx:latest
sudo docker pull mysql:latest
sudo docker pull httpd:latest

Note: Before we start first we need to check these ports if they are used or not If they are used, we need to determinate them

➤ Start nginx on port 80:80 :

sudo docker run -d -p 80:80 --name mynginx nginx:latest

➤ Start apache server on port 8080:80 :

sudo docker run -d -p 8080:80 --name myapache httpd:latest

➤ Start mysql on port 3306:3306 :

sudo docker run -d -p 3306:3306 --name mymysql -e MYSQL_RANDOM_ROOT_PASSWORD=yes mysql

Now we check our running Containers

sudo docker container ls

Now we use the following command to get the random root password for the MySQL container :

sudo docker container logs mymysql

We should see output like this:

[Entrypoint] GENERATED ROOT PASSWORD: xxxxxxxx

Once we have confirmed that we have the root password, we can clean up all the containers using the following commands:

sudo docker stop mynginx myapache mymysql
sudo docker container rm -f mynginx myapache mymysql

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published