环境
- VMware Workstation Pro
- ubuntu-23.04
常用命令
- 启动docker
systemctl start docker
- 重启docker
service docker restart
- 查看docker版本
docker version
Client: Docker Engine - Community
Version: 25.0.2
API version: 1.44
Go version: go1.21.6
Git commit: 29cf629
Built: Thu Feb 1 00:23:03 2024
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 25.0.2
API version: 1.44 (minimum version 1.24)
Go version: go1.21.6
Git commit: fce6e0c
Built: Thu Feb 1 00:23:03 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.28
GitCommit: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
runc:
Version: 1.1.12
GitCommit: v1.1.12-0-g51d5e94
docker-init:
Version: 0.19.0
GitCommit: de40ad0
- 查看镜像
sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 39286ab8a5e1 5 weeks ago 188MB
hello-world latest d2c94e258dcb 16 months ago 13.3kB
- 查看docker相关信息
docker info
Client: Docker Engine - Community
Version: 25.0.2
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.12.1
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.24.5
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 4
Running: 1
Paused: 0
Stopped: 3
Images: 2
Server Version: 25.0.2
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
runc version: v1.1.12-0-g51d5e94
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.2.0-39-generic
Operating System: Ubuntu 23.04
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.878GiB
Name: ubuntufordocker
ID: c05ce798-7140-478e-a26e-4123bd1bb7a9
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://docker.m.daocloud.io/
https://registry.docker-cn.com/
http://hub-mirror.c.163.com/
https://pee6w651.mirror.aliyuncs.com/
Live Restore Enabled: false
- 修改docker镜像获取地址
1. 编辑docker镜像地址
vi /etc/docker/daemon.json
{
"registry-mirrors": [
"https://docker.m.daocloud.io"
]
}
2. 重启docker服务
systemctl restart docker.service
- 查看镜像打包历史
dokcer history image-name
root@ubuntufordocker:/etc/docker# docker history hello-world
IMAGE CREATED CREATED BY SIZE COMMENT
d2c94e258dcb 16 months ago CMD ["/hello"] 0B buildkit.dockerfile.v0
<missing> 16 months ago COPY hello / # buildkit 13.3kB buildkit.dockerfile.v0