Skip to content

Docker Lab 4

Before

Jika ini lab pertama anda

git clone -b lab_start https://github.com/arrow2601/Docker_Lab.git
cd Docker_Lab
bash docker_start_lab.sh
Jika ini bukan lab pertama anda
cd Docker_Lab
git pull
bash docker_start_lab.sh
docker-lab-4-start

## Practice I

  1. Running mysql container with additional parameter (env)
    root@debianMaster:~# docker run -d --name my-mysql -e MYSQL_ROOT_PASSWORD=latihan05 -p 3306:3306 mysql
    
  2. Pull image phpmyadmin from DockerHub
    root@debianMaster:~# docker pull phpmyadmin
    
  3. Running phpmyadmin container and connect it with mysql container
    root@debianMaster:~# docker run --name my-phpmyadmin -d --link my-mysql:db -p 8090:80 phpmyadmin
    
  4. Test Browsing
    Open in browser http://your_ip_address:8090 login iwth user: `root` dan password: `latihan05`
    

Practice II

  1. Run Ubuntu containers with names ubuntu1 & ubuntu2
    root@debianMaster:~# docker run -dit --name ubuntu1 ubuntu
    root@debianMaster:~# docker run -dit --name ubuntu2 ubuntu
    
  2. Display list container
    root@debianMaster:~# docker ps
    
  3. Pause container ubuntu
    root@debianMaster:~# docker pause ubuntu1
    root@debianMaster:~# docker pause ubuntu2
    
  4. Check in list container if the container status is paused.
    root@debianMaster:~# docker ps
    
  5. Check resource usage when the ubuntu container is paused
    root@debianMaster:~# docker stats ubuntu1
    root@debianMaster:~# docker stats ubuntu2
    
  6. Unpause container ubuntu1
    root@debianMaster:~# docker unpause ubuntu1
    

Practice III

  1. Create datase containers with limited specifications
    root@debianMaster:~# docker container run -d --name ch6_mariadb --memory 256m --cpu-shares 1024 --cap-drop net_raw -e MYSQL_ROOT_PASSWORD=test mariadb:5.5
    
  2. Create a wordpress container and connect it to database container
    root@debianMaster:~# docker container run -d -p 80:80 -P --name ch6_wordpress --memory 512m --cpu-shares 512 --cap-drop net_raw --link ch6_mariadb:mysql -e WORDPRESS_DB_PASSWORD=test wordpress:5.0.0-php7.2-apache
    
  3. Check logs, running process, and resource.
    root@debianMaster:~# docker logs ch6_mariadb
    root@debianMaster:~# docker logs ch6_wordpress
    
    root@debianMaster:~# docker top ch6_wordpress
    root@debianMaster:~# docker top ch6_mariadb
    
    root@debianMaster:~# docker stats ch6_mariadb
    root@debianMaster:~# docker stats ch6_wordpress
    
  4. Test Browsing
    Open in browser http://your_ip_address then complete the installation
    

Finish

Untuk keluar dari lab exit kemudian cek di browser http://89.116.134.157/index.php