- Distributed Computing with Go
- V.N. Nikhil Anurag
- 446字
- 2021-06-24 18:36:08
Testing Docker setup
Let's ensure that our Docker setup works perfectly. For our purpose, Docker Community Edition should suffice (https://www.docker.com/community-edition). Once we have it installed, we will check if it works by running a few basic commands.
Let's start by checking what version we have installed:
$ docker --version Docker version 17.12.0-ce, build c97c6d6
Let's try to dig deeper into details about our Docker installation:
$ docker info
Containers: 38
Running: 0
Paused: 0
Stopped: 38
Images: 24
Server Version: 17.12.0-ce
Let's try to run a Docker image. If you remember the discussion regarding the Docker registry, you know that we do not need to build a Docker image using Dockerfile, to run a Docker container. We can directly pull it from Docker Hub (the default Docker registry) and run the image as a container:
$ docker run docker/whalesay cowsay Welcome to GopherLand!
Unable to find image 'docker/whalesay:latest' locally Trying to pull repository docker.io/docker/whalesay ... sha256:178598e51a26abbc958b8a2e48825c90bc22e641de3d31e18aaf55f3258ba93b: Pulling from docker.io/docker/whalesay e190868d63f8: Pull complete 909cd34c6fd7: Pull complete 0b9bfabab7c1: Pull complete a3ed95caeb02: Pull complete 00bf65475aba: Pull complete c57b6bcc83e3: Pull complete 8978f6879e2f: Pull complete 8eed3712d2cf: Pull complete Digest: sha256:178598e51a26abbc958b8a2e48825c90bc22e641de3d31e18aaf55f3258ba93b Status: Downloaded newer image for docker.io/docker/whalesay:latest ________________________ < Welcome to GopherLand! > ------------------------ \ \ \ ## . ## ## ## == ## ## ## ## === /""""""""""""""""___/ === ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~ \______ o __/ \ __/ \__________/
The preceding command could also have been executed, as shown here though, merely using docker run ..., which is more convenient:
$ docker pull docker/whalesay & docker run docker/whalesay cowsay Welcome to GopherLand!
Once we have a long set of built images, we can list them all and similarly for Docker containers:
$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/docker/whalesay latest 6b362a9f73eb 2 years ago 247 MB $ docker container ls --all CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES a1b1efb42130 docker/whalesay "cowsay Welcome to..." 5 minutes ago Exited (0) 5 minutes ago frosty_varahamihira
Finally, it is important to note that as we keep using docker to build and run images and containers, we will start creating a backlog of "dangling" images, which we might not really use again. However, they will end up eating storage space. In order to get rid of such "dangling" images, we can use the following command:
$ docker rmi --force 'docker images -q -f dangling=true' # list of hashes for all deleted images.
- 嵌入式Linux開發技術
- Mastering ElasticSearch
- 新手易學:系統安裝與重裝
- Windows Server 2012 Hyper-V Cookbook
- Installing and Configuring Windows 10:70-698 Exam Guide
- 混沌工程實戰:手把手教你實現系統穩定性
- Microsoft Operations Management Suite Cookbook
- 直播系統開發:基于Nginx與Nginx-rtmp-module
- Android物聯網開發細致入門與最佳實踐
- Mastering Reactive JavaScript
- jQuery UI Cookbook
- Kali Linux高級滲透測試
- CentOS 6 Linux Server Cookbook
- Linux內核API完全參考手冊(第2版)
- 鴻蒙HarmonyOS應用開發入門