After installing Docker, verify that the installation is successful
1. Verify in Linux systems (Ubuntu, CentOS, etc.)
Check Docker service status
- Available
systemctl
Command to view the status of the Docker service. - For example, enter in the terminal
sudo systemctl status docker
, If Docker is installed successfully and is running, a message similar to the following will be displayed:
● - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/; enabled; vendor preset: enabled)
Active: active (running) since Mon 2024-01-01 10:00:00 UTC; 1h ago
- Where "Active: active (running)" means that the Docker service is running.
- If "inactive (dead)" is displayed, it means that the service has not started and can be used
sudo systemctl start docker
Command to start the service.
Run simple Docker commands
- You can try running
docker version
command, it will display version information for Docker client and server side. - For example:
Client: Version: 20.10.17 API version: 1.41 Go version: go1.17.11 Git commit: 100c701 Built: Mon Dec 19 17:35:19 2022 UTC OS/Environment: linux Experimental: false Server: Engine: Version: 20.10.17 API version: 1.41 Go version: go1.17.11 Git commit: 100c701 Built: Mon Dec 19 17:35:19 2022 UTC OS/Environment: linux Experimental: false containerd: Version: 1.6.6 GitCommit: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1 runc: Version: 1.1.4 GitCommit: v1.1.4 - 0 - ga916309
- This indicates that both the Docker client and server are installed correctly and can communicate normally.
- In addition, it can also run
docker info
Command, it will provide more detailed information about the Docker system, such as the number of mirrors, containers, storage drivers, etc.
Try pulling a simple image and running the container
- run
docker pull hello - world
Command to pull a simple "hello - world" image from Docker Hub (Docker official image repository).
If the installation is successful, you will see an output similar to the following:
Using default tag: latest
latest: Pulling from library/hello - world
2db29710123e: Pull complete
Digest: sha256:51a9c7c10b6839e165755c5a0985353f3ad52939a43d3922948a1223030bc1c0
Status: Downloaded newer image for hello - world:latest
- Then run
docker run hello - world
Command to start a container based on this image. - If everything is working, you will see a message similar to "Hello from Docker!", which proves that Docker can pull the image normally and run the container.
2. Verify in Windows
Check Docker Desktop icons and status
- After successful installation, the Docker Desktop icon will appear in the system tray (to the right of the taskbar).
- Hovering over the icon will display the status information of Docker Desktop, such as "Docker Desktop is running".
- If the icon is gray or there is an error message, it may mean that Docker is not installed correctly or has encountered problems.
Verification via command prompt or PowerShell
- Open Command Prompt (CMD) or PowerShell and run
docker version
The command, like in Linux systems, displays version information of the Docker client and server side (Docker server in Linux virtual machines running through Hyper-V in Windows). - Can also run
docker info
Command to get more detailed information. - You can also try pulling and running the "hello - world" image to verify further, similar steps as in Linux systems.
3. Verify in Mac system
Check Docker Desktop icons and status
- The Docker Desktop icon will appear in the menu bar of your Mac.
- If the icon is green and "Docker Desktop is running", it means Docker has been installed successfully and is running.
- If the icon is gray or there is an error message, it may indicate that there is a problem with the installation.
Verification by terminal
- Open the terminal and run
docker version
anddocker info
Commands to check version information and Docker system details. - Like other systems, you can also verify by pulling the "hello - world" image and running the container.
docker pull hello - world
anddocker run hello - world
Command to see if the output is normal.
Summarize
The above is personal experience. I hope you can give you a reference and I hope you can support me more.