Skip to content

Docker Lab 2

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

## Practice 1

  1. Search image redis from dockerhub
    docker search redis
    
  2. Running image Redis
     docker run -d --name redis1 redis # Giving the container a name
    
  3. Display running container
     docker ps
     docker container ls
    
  4. Display all docker container
     docker ps -a
     docker container ls -a
    
  5. Display container description
     docker inspect redis1
    
  6. Display content of the logs in container
     docker logs redis1
    
  7. Display live stream resource used in container
     docker stats redis1
    
  8. Display running process in container
     docker top redis1
    
  9. Shutdown container
     docker stop redis1
    

Practice 2

  1. Search image nginx from dockerhub

     docker search nginx
    

  2. Running image nginx and expose to port host

     docker run -d --name nginx1 -p 80:80 nginx
    

  3. Display a description of the nginx container
     docker inspect nginx1
    
  4. Running image nginx adn declare the container port
     docker run -d --name nginx2 -p 80 nginx
    
  5. Test Browsing
     curl localhost:$(docker port nginx2 80 | cut -d : -f 2)
    
  6. Display container (All)
     docker ps -a
     docker container ls -a
    
  7. Display image docker
     docker images
    

Finish

Untuk grading lab masukan perintah docker-lab-2-grade untuk keluar dari lab exit kemudian cek di browser http://89.116.134.157/index.php