The document provides instructions on Docker practice including prerequisites, basic Docker commands, running containers from images, committing container changes to new images, logging into Docker Hub and pushing images.
It begins with prerequisites of having Ubuntu 18.04 or higher and installing the latest Docker engine and Docker compose. It then explains that Docker runs processes in isolated containers and uses layered images.
The document demonstrates basic commands like docker version, docker images, docker pull, docker search, docker run, docker ps, docker stop, docker rm and docker rmi. It also shows how to commit container changes to a new image with docker commit, tag and push images to Docker Hub. Other topics covered include docker exec, docker save/load, docker
3. Docker?
별도 Process
적층형 이미지
출처: https://www.enterprisetech.com/2014/08/18/ibm-techies-pit-docker-kvm-bare-metal
https://2eof2j3oc7is20vt9q3g7tlo5xe-wpengine.netdna-ssl.com/wp-content/uploads/2014/08/ibm-various-virtualization.jpg
4. 기본 명령어
sudo docker version
docker images
root@hwy:~# docker version
Client: Docker Engine - Community
Version: 19.03.2
API version: 1.40
Go version: go1.12.8
Git commit: 6a30dfc
Built: Thu Aug 29 05:29:11 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.2
API version: 1.40 (minimum version 1.12)
Go version: go1.12.8
Git commit: 6a30dfc
Built: Thu Aug 29 05:27:45 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.6
GitCommit: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc:
Version: 1.0.0-rc8
GitCommit: 425e105d5a03fabd737a126ad93d62a9eeede87f
docker-init:
Version: 0.18.0
GitCommit: fec3683
root@hwy:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
test 0.1 70e817b514c4 3 weeks ago 876MB
test_test 0.1 60f9924c8777 3 weeks ago 1.22MB
busybox latest b534869c81f0 4 weeks ago 1.22MB
ubuntu 16.04 56bab49eef2e 5 weeks ago 123MB
mysql 5.7 1e4405fe1ea9 6 weeks ago 437MB
nginx latest 231d40e811cd 6 weeks ago 126MB
5. docker pull
docker search
root@hwy:~# docker pull ubuntu:18.04
18.04: Pulling from library/ubuntu
2746a4a261c9: Pull complete
4c1d20cdee96: Pull complete
0d3160e1d0de: Pull complete
c8e37668deea: Pull complete
Digest: sha256:250cc6f3f3ffc5cdaa9d8f4946ac79821aafb4d3afc93928f0de9336eba21aa4
Status: Downloaded newer image for ubuntu:18.04
docker.io/library/ubuntu:18.04
root@hwy:~# docker search ubuntu
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
ubuntu Ubuntu is a Debian-based Linux operating sys… 10328 [OK]
dorowu/ubuntu-desktop-lxde-vnc Docker image to provide HTML5 VNC interface … 381 [OK]
rastasheep/ubuntu-sshd Dockerized SSH service, built on top of offi… 239 [OK]
consol/ubuntu-xfce-vnc Ubuntu container with "headless" VNC session… 203 [OK]
ubuntu-upstart Upstart is an event-based replacement for th… 102 [OK]
ansible/ubuntu14.04-ansible Ubuntu 14.04 LTS with ansible 98 [OK]
neurodebian NeuroDebian provides neuroscience research s… 63 [OK]
1and1internet/ubuntu-16-nginx-php-phpmyadmin-mysql-5 ubuntu-16-nginx-php-phpmyadmin-mysql-5 50 [OK]
ubuntu-debootstrap debootstrap --variant=minbase --components=m… 41 [OK]
nuagebec/ubuntu Simple always updated Ubuntu docker images w… 24 [OK]
i386/ubuntu Ubuntu is a Debian-based Linux operating sys… 18
1and1internet/ubuntu-16-apache-php-5.6 ubuntu-16-apache-php-5.6 14 [OK]
1and1internet/ubuntu-16-apache-php-7.0 ubuntu-16-apache-php-7.0 13 [OK]
1and1internet/ubuntu-16-nginx-php-phpmyadmin-mariadb-10 ubuntu-16-nginx-php-phpmyadmin-mariadb-10 11 [OK]
…
7. root@hwy:~# docker run -i -t ubuntu:latest /bin/bash
(i : interactive(사용자 입출력), t: tty)
exit 입력 -> container 종료
root@hwy:~# docker run -i -t ubuntu:latest /bin/bash
root@c7c709ecddb6:/#
root@c7c709ecddb6:/# uname -a
Linux c7c709ecddb6 4.15.0-65-generic #74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
root@c7c709ecddb6:/# whoami
root
root@c7c709ecddb6:/# ls
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
root@c7c709ecddb6:/#
root@c7c709ecddb6:/#
root@c7c709ecddb6:/# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 04:53 pts/0 00:00:00 /bin/bash
root 13 1 0 04:56 pts/0 00:00:00 ps -ef
root@c7c709ecddb6:/#
8. docker ps
docker start
without shell
docker attach
root@hwy:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c7c709ecddb6 ubuntu:latest "/bin/bash" 5 minutes ago Exited (127) 5 seconds ago unruffled_leakey
root@hwy:~# docker start unruffled_leakey
unruffled_leakey
root@hwy:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c7c709ecddb6 ubuntu:latest "/bin/bash" 7 minutes ago Up 13 seconds unruffled_leakey
※ docker run = 컨테이너 생성 + docker start + docker attach
root@hwy:~# docker attach unruffled_leakey
root@c7c709ecddb6:/#
attach 된 상태에서 exit하면 container 가 종료됨
container를 종료하지 않고 쉘에서 빠져나오려면
Ctrl + P,Q
root@c7c709ecddb6:/# read escape sequence
root@hwy:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED
c7c709ecddb6 ubuntu:latest "/bin/bash" 17 minutes ago
9. docker stop
docker rm [이름]
컨테이너 삭제
docker rmi [리포지토리 이름]
이미지 삭제
root@hwy:~# docker stop unruffled_leakey
unruffled_leakey
root@hwy:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
root@hwy:~#
10. root@hwy:~# docker run -d --name mynginx nginx
03a6c48083eb256d65f21f056a6080e288f2ac071854fb24c1a95c9b82bdb6a4
docker run -d --name mynginx -p 8000:80 nginx
root@hwy:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
03a6c48083eb nginx "nginx -g 'daemon of…" 8 seconds ago Up 6 seconds 80/tcp mynginx
-d
detached 옵션으로
백그라운드로 실행
-p 포트맵핑
서버 포트 : 컨테이너 포트
11. docker exec root@hwy:~# docker run -i -t --name hello ubuntu /bin/bash
root@hwy:~# docker exec hello echo 1
root@hwy:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6a3d2aa1a1e3 ubuntu "/bin/bash" 59 seconds ago Up 57 seconds hello
2d35fa16ce28 nginx "nginx -g 'daemon of…" 16 minutes ago Up 16 minutes 0.0.0.0:8000->80/tcp mynginx
root@hwy:~# docker exec hello touch /hello.txt
root@hwy:~# docker attach hello
root@6a3d2aa1a1e3:/# ls /
bin boot dev etc hello.txt home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
12. docker commit
root@hwy:~# docker commit 6a3d2aa1a1e3 test_commit:0.1
sha256:efc60c45ec5e59646e1a98e583ea930e7b37b1e0c742b20b2d1e34e46bec71b5
root@hwy:~# docker images
root@hwy:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
test_commit 0.1 efc60c45ec5e 6 seconds ago 64.2MB
root@hwy:~# docker run -it test_commit:0.1
root@d6aee93a68f0:/# ls /
a.txt bin boot dev etc hello.txt home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
13. docker login
docker logout
docker tag
docker push
root@hwy:~# docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: wyhwang
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
root@hwy:~# docker tag test_commit:0.1 wyhwang/test_commit:latest
root@hwy:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
wyhwang/test_commit latest efc60c45ec5e 37 minutes ago 64.2MB
test_commit 0.1 efc60c45ec5e 37 minutes ago 64.2MB
root@hwy:~# docker push wyhwang/test_commit
The push refers to repository [docker.io/wyhwang/test_commit]
ecd5f9c09d7f: Pushed
122be11ab4a2: Mounted from library/ubuntu
7beb13bce073: Mounted from library/ubuntu
f7eae43028b3: Mounted from library/ubuntu
6cebf3abed5f: Mounted from library/ubuntu
latest: digest: sha256:761c63eecaa66abc156b314275967204c3219e06d442b10a732b4800f41664ff size: 1359
Docker Hub에 이미지를 올리려면 이미지 이름을 <Docker Hub 사용자 계정>/<이미지 이름>:<버전> 형식으로 생성해야 함
14.
15. docker save
docker load
root@hwy:~# docker save test_commit:0.1 > ./save.tgz
root@hwy:~# ls
git save.tgz
root@hwy:~# docker load < ./save.tgz
Loaded image: test_commit:0.1
root@hwy:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
test_commit 0.1 efc60c45ec5e About an hour ago 64.2MB
ubuntu 18.04 549b9b86cb8d 2 weeks ago 64.2MB
test 0.1 70e817b514c4 3 weeks ago 876MB
test_test 0.1 60f9924c8777 3 weeks ago 1.22MB
16. docker volume prune
docker network prune
docker cp
컨테이너 파일을 호스트로 복사
(또는 그 반대방향)
root@hwy:~# docker run -it test_commit:0.1
root@ea19aba8d286:/# ls
a.txt bin boot dev etc hello.txt home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
root@ea19aba8d286:/# root@hwy:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ea19aba8d286 test_commit:0.1 "/bin/bash" 44 seconds ago Up 42 seconds modest_raman
root@hwy:~# docker cp ea19aba8d286:hello.txt ./
root@hwy:~# ll
total 65092
drwx------ 8 root root 4096 Jan 7 08:15 ./
drwxr-xr-x 24 root root 4096 Jan 6 04:11 ../
-rw------- 1 root root 4741 Jan 6 08:20 .bash_history
-rw-r--r-- 1 root root 3106 Apr 9 2018 .bashrc
drwx------ 2 root root 4096 Sep 25 23:59 .cache/
drwx------ 2 root root 4096 Jan 7 07:38 .docker/
drwxr-xr-x 3 root root 4096 Dec 13 01:34 git/
drwx------ 3 root root 4096 Sep 25 23:59 .gnupg/
-rw-r--r-- 1 root root 0 Jan 6 06:30 hello.txt
drwxr-xr-x 3 root root 4096 Sep 26 00:46 .local/
-rw-r--r-- 1 root root 148 Aug 17 2015 .profile
-rw-r--r-- 1 root root 66598400 Jan 7 08:08 save.tgz
drwx------ 2 root root 4096 Sep 16 03:34 .ssh/
-rw------- 1 root root 3579 Dec 13 02:02 .viminfo
docker container prune 중지된 모든 컨테이너를 삭제
docker image prune 이름 없는 모든 이미지를 삭제
docker network prune 사용되지 않는 도커 네트워크를 모두 삭제
docker volume prune 컨테이너에서 사용하지 않는 모든 볼륨을 삭제
docker system prune -a 중지된 모든 컨테이너, 미사용 네트워크, 컨테이너에서 사용하지 않는 모든 이미지 삭제
18. Make Docker Image
Dockerfile 명세 명령어
FROM: 기본 이미지 지정
LABEL: Meta 정보(version, name 등)
RUN: 커맨드 명령 실행 부분
ENV: 환경변수 선언 (도커 실행시 외부 주입 가능)
COPY: Local 디스크의 파일을 컨테이너 내부로 복사
ENTRYPOINT: 런타임시 최종적 실행해야 하는 명령어
EXPOSE: Port mapping
빌드시 캐싱 주의
19. Make Docker Image – ex1
mkdir sample && cd $_
touch Dockerfile
docker build -t sample:1.0 ./
hyper@hwy:~/sample$ more Dockerfile
FROM centos:centos7
hyper@hwy:~/sample$ docker build -t sample:1.0 ./
Sending build context to Docker daemon 2.048kB
Step 1/1 : FROM centos:centos7
centos7: Pulling from library/centos
ab5ef0e58194: Pull complete
Digest: sha256:4a701376d03f6b39b8c2a8f4a8e499441b0d567f9ab9d58e4991de4472fb813c
Status: Downloaded newer image for centos:centos7
---> 5e35e350aded
Successfully built 5e35e350aded
Successfully tagged sample:1.0
20. Make Docker Image – ex2
vi Dockerfile.mine
docker build -t sample2:0.1 -f Dockerfile.mine .
docker images
docker run -d -p 80:80 sample2:0.1
curl http://localhost
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y -q nginx
COPY index.html /usr/share/nginx/html
CMD ["nginx", "-g", "daemon off;"]
HomeWork : https://khj93.tistory.com/entry/Docker-Docker-File-%EC%9E%91%EC%84%B1%ED%95%98%EA%B8%B0-%EB%AA%85%EB%A0%B9%EC%96%B4
21. Docker Compose
여러 컨테이너를 모아서 관리하기 위한 도구
docker-compose.yml 파일에 컨테이너 구성 정보를 정의
image: 사용할 docker image
volumes: container에 mount 할 호스트 볼륨
entrypoint: container load 이후 실행할 명령어
links: container dependency
ports: port mapping
environment: container 내부 환경변수
23. simple spring boot application
git clone https://github.com/chathurangat/spring-boot-data-jpa-example.git
mvn clean install -DskipTests (해당 프로젝트 디렉토리에서…)
java -jar target/spring-boot-data-jpa-example-0.0.1-SNAPSHOT.jar
source : https://springbootdev.com/2017/11/13/spring-boot-and-mysql-simple-crud-application-rest-apis-with-spring-data-jpa/
mysql 서비스가 현재 없으므로, 에러가 발생
apt-get install maven
24. mysql docker launch
docker run -d
-p 3306:3306
--name mysql-docker-container
-e MYSQL_ROOT_PASSWORD=root123
-e MYSQL_DATABASE=spring_app_db
-e MYSQL_USER=app_user
-e MYSQL_PASSWORD=test123
mysql:5.7
상기 정보에 맞춰서 spring boot application의 application.properties 정보를 수정한다.
spring.datasource.url = jdbc:mysql://mysql-docker-container:3306/spring_app_db?useSSL=false
spring.datasource.username = app_user
spring.datasource.password = test123
source https://springbootdev.com/2017/11/30/docker-spring-boot-and-spring-data-jpa-mysql-rest-api-example-with-docker-without-docker-compose/
26. validation
curl http://localhost:8087/api/users 로 서비스 확인
docker exec -it spring-jpa-app-container bash 로 어플리케이션 컨테이너 접속 etc/hosts 정보 확인
docker exec -it mysql-docker-container bash로 mysql 컨테이너 접속하여 etc/hosts 정보 확인
데이터베이스 확인
curl http://localhost:8087/api/users
[]
mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 14
Server version: 5.7.28 MySQL Community Server (GPL)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql>
source https://springbootdev.com/2017/11/30/docker-spring-boot-and-spring-data-jpa-mysql-rest-api-example-with-docker-without-docker-compose/
27. 여기서 잠깐…
root@hwy:/home/hyper/app# more Dockerfile
FROM java:8
LABEL maintainer=“test@gmail.com”
VOLUME /tmp
EXPOSE 8080
ADD spring-boot-data-jpa-example/target/spring-boot-data-jpa-example-0.0.1-SNAPSHOT.jar spring-boot-data-jpa-ex
ample-0.0.1-SNAPSHOT.jar
ENTRYPOINT ["java","-jar","spring-boot-data-jpa-example-0.0.1-SNAPSHOT.jar"]
drwxrwxrwt 7 root root 4096 Jan 13 10:41 ./
drwxr-xr-x 3 root root 4096 Jan 10 08:24 ../
-rw-r--r-- 1 root root 0 Jan 13 10:41 aaaaaa
drwxr-xr-x 2 root root 4096 Jan 13 10:19 hsperfdata_root/
drwxr-xr-x 3 root root 4096 Jan 10 08:24 tomcat.4873343804251809410.8080/
drwxr-xr-x 3 root root 4096 Jan 13 10:19 tomcat.5421945121563885156.8080/
drwxr-xr-x 2 root root 4096 Jan 13 10:19 tomcat-docbase.4817131992489541769.8080/
drwxr-xr-x 2 root root 4096 Jan 10 08:24 tomcat-docbase.5170213756812424881.8080/
root@hwy:/var/lib/docker/volumes/0ef48eecf67e931101a3196725f09afaf784a176db90bd4660796c2f0781855f/_data#
<host>
root@hwy:/var/lib/docker/volumes/0ef48eecf67e931101a3196725f09afaf784a176db90bd4660796c2f0781855f/_data# docker exec -it spring-jpa-app-container bash
root@54a20f888946:/# cd tmp
root@54a20f888946:/tmp# ls -al
total 28
drwxrwxrwt 7 root root 4096 Jan 13 10:41 .
drwxr-xr-x 1 root root 4096 Jan 10 08:24 ..
-rw-r--r-- 1 root root 0 Jan 13 10:41 aaaaaa
drwxr-xr-x 2 root root 4096 Jan 13 10:19 hsperfdata_root
drwxr-xr-x 2 root root 4096 Jan 13 10:19 tomcat-docbase.4817131992489541769.8080
drwxr-xr-x 2 root root 4096 Jan 10 08:24 tomcat-docbase.5170213756812424881.8080
drwxr-xr-x 3 root root 4096 Jan 10 08:24 tomcat.4873343804251809410.8080
drwxr-xr-x 3 root root 4096 Jan 13 10:19 tomcat.5421945121563885156.8080
<container>
28. Docker-compose Practice
https://springbootdev.com/2018/01/08/docker-spring-boot-and-spring-data-
jpa-mysql-rest-api-example-with-docker-with-docker-compose/
root@hwy:/home/hyper/app# more spring-boot-data-jpa-example/src/main/resources/application.properties
## Spring DATA SOURCE Configurations
spring.datasource.url = jdbc:mysql://mysql-docker-container-dc:3306/spring_app_db?useSSL=false
spring.datasource.username = app_user
spring.datasource.password = test123
## Hibernate Properties
# The SQL dialect makes Hibernate generate better SQL for the chosen database
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
# Hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto = update
root@hwy:/home/hyper/app#
root@hwy:/home/hyper/app/spring-boot-data-jpa-example# !688
mvn clean install -DskipTests
source : https://springbootdev.com/2018/01/08/docker-spring-boot-and-spring-data-jpa-mysql-rest-api-example-with-docker-with-docker-compose/
https://asciinema.org/a/FoUFk1TwzZHu3szzbRnqkxOzI
30. Docker compose build
root@hwy:/home/hyper/app# more docker-compose.yml
version: '3'
services:
mysql-docker-container-dc:
image: mysql:5.7
environment:
- MYSQL_ROOT_PASSWORD=root123
- MYSQL_DATABASE=spring_app_db
- MYSQL_USER=app_user
- MYSQL_PASSWORD=test123
volumes:
- /data/mysql
ports:
- 3307:3306
spring-boot-jpa-app-dc:
image: spring-jpa-app-dc
build:
context: ./
dockerfile: Dockerfile
depends_on:
- mysql-docker-container-dc
ports:
- 8088:8080
volumes:
- /data/spring-boot-app
spring.datasource.url = jdbc:mysql://mysql-docker-container-dc:3306/spring_app_db?useSSL=false
root@hwy:/home/hyper/app# more Dockerfile
FROM java:8
LABEL maintainer=“chathuranga.t@gmail.com”
VOLUME /tmp
EXPOSE 8080
ADD spring-boot-data-jpa-example/target/spring-boot-data-jpa-example-0.0.1-SNAPSHOT.jar spring-boot-data-jpa-example-0.0.1-SNAPSHOT.jar
ENTRYPOINT ["java","-jar","spring-boot-data-jpa-example-0.0.1-SNAPSHOT.jar"]
docker-compose build
docker-compose up
source : https://springbootdev.com/2018/01/08/docker-spring-boot-and-spring-data-jpa-mysql-rest-api-example-with-docker-with-docker-compose/
The image name is “spring-boot-jpa-image“. If the image does not exist, it should be built with the Dockerfile available in the current working directory.
42. deploying a workload
source : https://rancher.com/docs/rancher/v2.x/en/quick-start-guide/workload/quickstart-deploy-workload-ingress/
43. Expose The Application Via An Ingress
source : https://rancher.com/docs/rancher/v2.x/en/quick-start-guide/workload/quickstart-deploy-workload-ingress/
46. [controlPlane] Failed to bring up Control Plane: [Failed to create [kube-apiserver]
container on host [10.0.2.15]: Failed to create Docker container [kube-apiserver]
on host [10.0.2.15]: <nil>]
수동으로 관련 이미지 pull 하였을 경우(docker pull
rancher/hyperkube:v1.17.0-rancher1),
failed to register layer: Error processing tar file(exit status 1): write
/opt/az/lib/python3.6/site-
packages/azure/mgmt/web/models/__pycache__/certificate_details.cpython-
36.pyc: no space left on device
에러 발생하여, 아래 내용 수행하여 해결
docker system df
If RECLAIMABLE amount is greater than zero (that would definitely the case)
then run command
docker system prune -a
Editor's Notes
id가 없는 이미지가 공식 이미지
docker run = docker start + docker attach
root@hwy:~# ll /var/lib/docker/overlay2/
root@hwy:~# touch abc.txt
root@hwy:~# docker cp ./abc.txt ea19aba8d286
must specify at least one container source
root@hwy:~# docker cp ./abc.txt ea19aba8d286:./
root@hwy:~# docker attach ea
root@ea19aba8d286:/# ls
a.txt abc.txt bin boot dev etc hello.txt home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
root@ea19aba8d286:/#
--no-cache
[daemon off 참고] https://roseline124.github.io/kuberdocker/2019/07/24/docker-study05.html
https://darkrasid.github.io/docker/container/volume/2017/05/10/docker-volumes.html
https://jungwoon.github.io/docker/2019/01/13/Docker-3/
docker run -itd -v /host/some/where:/container/some/where ubuntu
root@hwy:~# docker exec -it sharp_ganguly bash
docker logs –tail 10 –f dc7
docker system dfIf RECLAIMABLE amount is greater than zero (that would definitely the case) then run commanddocker system prune -a