Docker常用命令

帮助命令

# 显示 Docker 版本信息
docker version # 显示系统信息,包括镜像和容器的数量
docker info # 查看帮助文档 帮助文档地址:https://docs.docker.com/reference/
docker [命令] --help

镜像命令

查看最近创建的镜像

docker images 查看最近创建的镜像

docker images [OPTIONS] [REPOSITORY[:TAG]]

# 帮助文档
[root@hwh1 ~]# docker images --help
Usage: docker images [OPTIONS] [REPOSITORY[:TAG]]
List images
Options:
-a, --all Show all images (default hides intermediate images) 显示所有镜像
--digests Show digests 显示摘要
-f, --filter filter Filter output based on conditions provided 根据提供的条件过滤输出
--format string Pretty-print images using a Go template 用 Go 模板打印出一个图像
--no-trunc Don't truncate output 不截断输出
-q, --quiet Only show numeric IDs 只显示数字 ID # 查看最近创建的镜像
# REPOSITORY 镜像的仓库源
# TAG 镜像的标签
# IMAGE ID 镜像的id
# CREATED 镜像的创建时间
# SIZE 镜像的大小
[root@hwh1 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest bf756fb1ae65 5 months ago 13.3kB # 查看所有镜像
[root@hwh1 ~]# docker images -a
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest bf756fb1ae65 5 months ago 13.3kB # 只显示数字 ID
[root@hwh1 ~]# docker images -q
bf756fb1ae65

搜索镜像

docker search 搜索镜像

docker search [OPTIONS] TERM

[root@hwh1 ~]# docker search --help
Usage: docker search [OPTIONS] TERM
Search the Docker Hub for images
Options:
-f, --filter filter Filter output based on conditions provided 根据提供的条件过滤输出
--format string Pretty-print search using a Go template 用 Go 模板打印出一个图像
--limit int Max number of search results (default 25) 搜索结果的最大值限制
--no-trunc Don't truncate output 不截断输出 [root@hwh1 ~]# docker search mysql
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
mysql MySQL is a widely used, open-source relation… 9626

下载镜像

docker pull 下载镜像

docker pull [OPTIONS] NAME[:TAG|@DIGEST]

[root@hwh1 ~]# docker pull --help
Usage: docker pull [OPTIONS] NAME[:TAG|@DIGEST]
Pull an image or a repository from a registry
Options:
-a, --all-tags Download all tagged images in the repository 下载仓库中标记所有的镜像,拿来选择版本
--disable-content-trust Skip image verification (default true) 跳过图像验证
--platform string Set platform if server is multi-platform capable 如果服务器支持多平台,则设置平台
-q, --quiet Suppress verbose output 禁止详细输出 # 下载镜像
[root@hwh1 ~]# docker pull mysql
Using default tag: latest # 版本信息(默认不设置tag,则为最新版)
latest: Pulling from library/mysql
8559a31e96f4: Pull complete # 分层下载,docker image 的核心,联合文件系统
d51ce1c2e575: Pull complete
c2344adc4858: Pull complete
fcf3ceff18fc: Pull complete
16da0c38dc5b: Pull complete
b905d1797e97: Pull complete
4b50d1c6b05c: Pull complete
c75914a65ca2: Pull complete
1ae8042bdd09: Pull complete
453ac13c00a3: Pull complete
9e680cd72f08: Pull complete
a6b5dc864b6c: Pull complete
Digest: sha256:8b7b328a7ff6de46ef96bcf83af048cb00a1c86282bfca0cb119c84568b4caf6 # 签名
Status: Downloaded newer image for mysql:latest
docker.io/library/mysql:latest # 真实地址

删除镜像

docker rmi 删除镜像

docker rmi [OPTIONS] IMAGE [IMAGE...]

[root@hwh1 ~]# docker rmi --help
Usage: docker rmi [OPTIONS] IMAGE [IMAGE...]
Remove one or more images
Options:
-f, --force Force removal of the image 强制删除镜像
--no-prune Do not delete untagged parents 不删除未标记的父类 # 删除指定镜像
[root@hwh1 ~]# docker rmi mysql
Untagged: mysql:latest
Untagged: mysql@sha256:8b7b328a7ff6de46ef96bcf83af048cb00a1c86282bfca0cb119c84568b4caf6
Deleted: sha256:be0dbf01a0f3f46fc8c88b67696e74e7005c3e16d9071032fa0cd89773771576
Deleted: sha256:086d66e8d1cb0d52e9337eabb11fb9b95960e2e1628d90100c62ea5e8bf72306
Deleted: sha256:f37c61ee1973b18c285d0d5fcf02da4bcdb1f3920981499d2a20b2858500a110
Deleted: sha256:e40b8bca7dc63fc8d188a412328e56caf179022f5e5d5b323aae57d233fb1069
Deleted: sha256:339f6b96b27eb035cbedc510adad2560132925a835f0afddbcc1d311c961c14b
Deleted: sha256:d38b06cdb26a5c98857ddbc6ef531d3f57b00e325c0c314600b712efc7ff6ab0
Deleted: sha256:09687cd9cdf4c704fde969fdba370c2d848bc614689712bef1a31d0d581f2007
Deleted: sha256:b704a4a65bf536f82e5d8b86e633d19185e26313de8380162e778feb2852011a
Deleted: sha256:c37206160543786228aa0cce738e85343173851faa44bb4dc07dc9b7dc4ff1c1
Deleted: sha256:12912c9ec523f648130e663d9d4f0a47c1841a0064d4152bcf7b2a97f96326eb
Deleted: sha256:57d29ad88aa49f0f439592755722e70710501b366e2be6125c95accc43464844
Deleted: sha256:b17c024283d0302615c6f0c825137da9db607d49a83d2215a79733afbbaeb7c3
Deleted: sha256:13cb14c2acd34e45446a50af25cb05095a17624678dbafbcc9e26086547c1d74 # 递归删除(批量删除)
[root@hwh1 ~]# docker rmi -f $(docker images -aq)
Untagged: hello-world:latest
Untagged: hello-world@sha256:6a65f928fb91fcfbc963f7aa6d57c8eeb426ad9a20c7ee045538ef34847f44f1
Deleted: sha256:bf756fb1ae65adf866bd8c456593cd24beb6a0a061dedf42b26a993176745f6b
# 已全部删除
[root@hwh1 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE

容器命令

注:下载一个 centos 镜像测试

新建容器并启动

docker run 新建容器并启动

[root@hwh1 ~]# docker pull centos
Using default tag: latest
latest: Pulling from library/centos
8a29a15cefae: Pull complete
Digest: sha256:fe8d824220415eed5477b63addf40fb06c3b049404242b31982106ac204f6700
Status: Downloaded newer image for centos:latest
docker.io/library/centos:latest docker run [root@hwh1 ~]# docker run --help
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
Run a command in a new container
Options:
-d, --detach Run container in background and print
container ID 后台方式运行
--name string Assign a name to the container 容器名字,来区分容器
-i, --interactive Keep STDIN open even if not attached 使用交互方式,进入容器查询内容
-t, --tty Allocate a pseudo-TTY 使用交互方式,进入容器查询内容
-p, --publish list Publish a container's port(s) to the host 指定容器端口
-p 主机端口:容器端口
-p 容器端口
-p ip:主机端口:容器端口
容器端口
-P, --publish-all Publish all exposed ports to random ports 随机端口 # 启动并进入容器,相当于一个小型虚拟机
[root@hwh1 ~]# docker run -it centos /bin/bash
[root@af833bdd3acf /]# ls # 基础版 centos 很多命令都不完善
bin etc lib lost+found mnt proc run srv tmp var
dev home lib64 media opt root sbin sys usr
[root@af833bdd3acf /]# exit # 退出命令
exit

列出所有正在运行的容器

docker ps 列出所有正在运行的容器

docker ps [OPTIONS]

[root@hwh1 ~]# docker ps --help
Usage: docker ps [OPTIONS]
List containers
Options:
-a, --all Show all containers (default shows just running) 列出所有的容器,包括正在运行和停止的
-f, --filter filter Filter output based on conditions provided
--format string Pretty-print containers using a Go template
-n, --last int Show n last created containers (includes all states) 列出最近运行的容器
(default -1)
-l, --latest Show the latest created container (includes all states) 显示最后创建的容器
--no-trunc Don't truncate output 不截断输出
-q, --quiet Only display numeric IDs 只显示数字 ID
-s, --size Display total file sizes 显示文件总大小 [root@hwh1 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a0f986785f33 centos "/bin/bash" 7 seconds ago Up 5 seconds nervous_agnesi
[root@hwh1 ~]# docker ps -n=1
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a0f986785f33 centos "/bin/bash" 6 minutes ago Up 6 minutes nervous_agnesi
[root@hwh1 ~]# docker ps -q
a0f986785f33

退出容器

exit             # 直接容器停止并退出
Ctrl + P + Q # 不停止容器退出(快捷键)

删除容器

docker rm 删除容器

docker rm [OPTIONS] CONTAINER [CONTAINER...]

[root@hwh1 ~]# docker rm --help
Usage: docker rm [OPTIONS] CONTAINER [CONTAINER...]
Remove one or more containers
Options:
-f, --force Force the removal of a running container (uses SIGKILL) 强制删除正在运行的容器
-l, --link Remove the specified link 删除指定的链接
-v, --volumes Remove anonymous volumes associated with the container 删除与容器关联的匿名卷 [root@hwh1 ~]# docker rm af833bdd3acf 删除已经停止的
af833bdd3acf
[root@hwh1 ~]# docker rm -f a0f986785f33 删除正在运行的容器
a0f986785f33 # docker ps -a -q|xargs docker rm # 删除所有的容器,使用管道符

启动和停止容器操作

docker start id       # 启动
docker restart id # 重启
docker stop id # 停止当前正在运行的容器
docker kill id # 强制停止当前容器 [root@hwh1 ~]# docker start 7b28015cd7f6
7b28015cd7f6
[root@hwh1 ~]# docker restart 7b28015cd7f6
7b28015cd7f6
[root@hwh1 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7b28015cd7f6 centos "/bin/bash" 46 seconds ago Up 9 seconds unruffled_wiles
e2ff2fee0669 bf756fb1ae65 "/hello" 12 days ago Exited (0) 12 days ago amazing_nightingale
690a9f41c7a8 bf756fb1ae65 "/hello" 12 days ago Exited (0) 12 days ago zealous_blackwell
[root@hwh1 ~]# docker stop 7b28015cd7f6
7b28015cd7f6
[root@hwh1 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7b28015cd7f6 centos "/bin/bash" 57 seconds ago Exited (0) 2 seconds ago unruffled_wiles
e2ff2fee0669 bf756fb1ae65 "/hello" 12 days ago Exited (0) 12 days ago amazing_nightingale
690a9f41c7a8 bf756fb1ae65 "/hello" 12 days ago Exited (0) 12 days ago

常用的其他命令

后台启动容器

# docker run -d 镜像名
[root@hwh1 ~]# docker run -d centos
9e34ebe17e41fb762f535ab21d81240b5fb4b105a44ed13c8813a8a8978f9b27
# 问题:
# docker ps -a,发现服务停止了
# 常见的坑:
# docker 容器使用后台运行,就必须要有要一个前台进程,docker发现没有应用,就会自动停止

查看日志

docker logs [OPTIONS] CONTAINER

[root@hwh1 ~]# docker logs --help
Usage: docker logs [OPTIONS] CONTAINER
Fetch the logs of a container
Options:
--details Show extra details provided to logs 显示额外的详细信息
-f, --follow Follow log output 跟踪日志输出
--since string Show logs since timestamp (e.g. 2013-01-02T13:23:37) or 从时间戳开始显示
relative (e.g. 42m for 42 minutes)
--tail string Number of lines to show from the end of the logs (default 日志显示行数
"all")
-t, --timestamps Show timestamps 显示时间戳
--until string Show logs before a timestamp (e.g. 2013-01-02T13:23:37) 在时间戳之前显示日志
or relative (e.g. 42m for 42 minutes)

查看容器中进程信息

docker top CONTAINER [ps OPTIONS]

[root@hwh1 ~]# docker top --help
Usage: docker top CONTAINER [ps OPTIONS]
Display the running processes of a container # docker top 容器id
[root@hwh1 ~]# docker top 147f08710d27
UID PID PPID C STIME
root 76123 76105 0 21:13

查看镜像的元数据

docker inspect [OPTIONS] NAME|ID [NAME|ID...]

[root@hwh1 ~]# docker inspect --help
Usage: docker inspect [OPTIONS] NAME|ID [NAME|ID...]
Return low-level information on Docker objects
Options:
-f, --format string Format the output using the given Go template 用 Go 模板打印出一个图像
-s, --size Display total file sizes if the type is container 如果类型是容器的话,就显示容器大小
--type string Return JSON for specified type 返回指定类型的 JSON 字符串 # 查看 centos 的元数据
[root@hwh1 ~]# docker inspect 147f08710d27
[
{
"Id": "147f08710d2732d81ee9ce2680a7cfad48cbd186e87e27b081d82c103a29f084",
"Created": "2020-06-15T13:13:13.783652979Z",
"Path": "/bin/bash",
"Args": [],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 76123,
"ExitCode": 0,
"Error": "",
"StartedAt": "2020-06-15T13:13:15.632825635Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:470671670cac686c7cf0081e0b37da2e9f4f768ddc5f6a26102ccd1c6954c1ee",
"ResolvConfPath": "/var/lib/docker/containers/147f08710d2732d81ee9ce2680a7cfad48cbd186e87e27b081d82c103a29f084/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/147f08710d2732d81ee9ce2680a7cfad48cbd186e87e27b081d82c103a29f084/hostname",
"HostsPath": "/var/lib/docker/containers/147f08710d2732d81ee9ce2680a7cfad48cbd186e87e27b081d82c103a29f084/hosts",
"LogPath": "/var/lib/docker/containers/147f08710d2732d81ee9ce2680a7cfad48cbd186e87e27b081d82c103a29f084/147f08710d2732d81ee9ce2680a7cfad48cbd186e87e27b081d82c103a29f084-json.log",
"Name": "/dazzling_benz",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"Capabilities": null,
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "private",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": [],
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"DeviceCgroupRules": null,
"DeviceRequests": null,
"KernelMemory": 0,
"KernelMemoryTCP": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": null,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": [
"/proc/asound",
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware"
],
"ReadonlyPaths": [
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/74794286462edce8a73f8e74239c0229d6cec3afac92f052951245d91e05c7cd-init/diff:/var/lib/docker/overlay2/ae0a1afad34903571dd0df8a39bc4bea93ccd793ae2f6185fa95385c18d56f05/diff",
"MergedDir": "/var/lib/docker/overlay2/74794286462edce8a73f8e74239c0229d6cec3afac92f052951245d91e05c7cd/merged",
"UpperDir": "/var/lib/docker/overlay2/74794286462edce8a73f8e74239c0229d6cec3afac92f052951245d91e05c7cd/diff",
"WorkDir": "/var/lib/docker/overlay2/74794286462edce8a73f8e74239c0229d6cec3afac92f052951245d91e05c7cd/work"
},
"Name": "overlay2"
},
"Mounts": [],
"Config": {
"Hostname": "147f08710d27",
"Domainname": "",
"User": "",
"AttachStdin": true,
"AttachStdout": true,
"AttachStderr": true,
"Tty": true,
"OpenStdin": true,
"StdinOnce": true,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"/bin/bash"
],
"Image": "centos",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {
"org.label-schema.build-date": "20200114",
"org.label-schema.license": "GPLv2",
"org.label-schema.name": "CentOS Base Image",
"org.label-schema.schema-version": "1.0",
"org.label-schema.vendor": "CentOS",
"org.opencontainers.image.created": "2020-01-14 00:00:00-08:00",
"org.opencontainers.image.licenses": "GPL-2.0-only",
"org.opencontainers.image.title": "CentOS Base Image",
"org.opencontainers.image.vendor": "CentOS"
}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "dcbcaf21dc6395481ce4c27bd58e83b306aee13216f852b4ac92edab13dc6698",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {},
"SandboxKey": "/var/run/docker/netns/dcbcaf21dc63",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "1b8456cbbb162e74762144d5a13305ba84acb45db92ce2467c0bc15724077b72",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:02",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "23077e8fffbf9407b9d83e492e05cc11904b4dbf7fd3ab3a4b84c36c1a7ee4a5",
"EndpointID": "1b8456cbbb162e74762144d5a13305ba84acb45db92ce2467c0bc15724077b72",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:02",
"DriverOpts": null
}
}
}
}
]

进入当前正在运行的容器

# 我们通常容器都是使用后台方式运行的,需要进入容器,修改一些配置
# 方式一 :docker exec -it 容器id bashShell
# 进入容器后开启一个新的终端,可以在里面操作(常用)
# docker exec [OPTIONS] CONTAINER COMMAND [ARG...] [root@hwh1 ~]# docker exec --help
Usage: docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
Run a command in a running container
Options:
-d, --detach Detached mode: run command in the background 在后台运行命令
--detach-keys string Override the key sequence for detaching a container 重写用于分离容器的键序列
-e, --env list Set environment variables 设置环境变量
-i, --interactive Keep STDIN open even if not attached 即使没有连接,也保持STDIN打开
--privileged Give extended privileges to the command 授予命令扩展权限
-t, --tty Allocate a pseudo-TTY 分配一个伪TTY
-u, --user string Username or UID (format: <name|uid>[:<group|gid>]) 用户名或者 id
-w, --workdir string Working directory inside the container 容器内的工作目录 [root@hwh1 ~]# docker exec -it a41c80fd6d1c /bin/bash
[root@a41c80fd6d1c /]# ls
bin etc lib lost+found mnt proc run srv tmp var
dev home lib64 media opt root sbin sys usr # 方式二 :docker attach 容器id
# 进入容器正在执行的终端,不会启动新的终端
# docker attach [OPTIONS] CONTAINER [root@hwh1 ~]# docker attach --help
Usage: docker attach [OPTIONS] CONTAINER
Attach local standard input, output, and error streams to a running container
Options:
--detach-keys string Override the key sequence for detaching a container 重写用于分离容器的键序列
--no-stdin Do not attach STDIN 不要附加STDIN
--sig-proxy Proxy all received signals to the process (default true) 将所有接收到的信号代理到进程(默认为true) [root@hwh1 ~]# docker attach a41c80fd6d1c
[root@a41c80fd6d1c /]# ls
bin etc lib lost+found mnt proc run srv tmp var
dev home lib64 media opt root sbin sys usr

拷贝文件

# 从容器被拷贝文件到主机上
# docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|- docker cp 容器id:容器内路径 目的的主机路径 # 从主机上拷贝文件到容器
# docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH docker cp 主机路径 容器id:目的的容器内路径 [root@hwh1 ~]# docker cp --help
Usage: docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-
docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH
Copy files/folders between a container and the local filesystem Use '-' as the source to read a tar archive from stdin
and extract it to a directory destination in a container.
Use '-' as the destination to stream a tar archive of a
container source to stdout. Options:
-a, --archive Archive mode (copy all uid/gid information) 存档模式(复制所有uid/gid信息)
-L, --follow-link Always follow symbol link in SRC_PATH 始终遵循容器内路径中的符号链接 # 从容器被拷贝文件到主机上
[root@hwh1 home]# docker attach a41c80fd6d1c
[root@a41c80fd6d1c /]# cd /home
[root@a41c80fd6d1c home]# ls
[root@a41c80fd6d1c home]# touch hwh.java # 在 home 目录下创建一个 hwh.java
[root@a41c80fd6d1c home]# ls
hwh.java
[root@hwh1 home]# ls
hwh hwh1 hwh2 user01 user02
[root@hwh1 home]# docker cp a41c80fd6d1c:/home/hwh.java /home # 将 hwh.java 复制到主机上
[root@hwh1 home]# ls
hwh hwh1 hwh2 hwh.java user01 user02

Docker(三)Docker常用命令的更多相关文章

  1. Docker基础和常用命令

    Docker基础和常用命令 一,Docker 简介 1.1,什么是 Docker Docker 使用 Google 公司推出的 Go 语言 进行开发实现,基于 Linux 内核的 cgroup,nam ...

  2. Docker 入门指南——常用命令

    前面已经介绍了 Docker 的安装方式,本文总结一下使用 Docker 的基本概念和常用命令. 基本概念 镜像 Image 镜像是一些打包好的已有的环境,可以被用来启动和创建容器 容器 Contai ...

  3. docker 安装与常用命令与常用容器(containers)环境

    注意区别 container 与 image 的关系,container 的建立需要 image 的承载,也即 container 依赖 image,停止并删除了 container 并不会删除 im ...

  4. Docker系列之常用命令操作手册

    目录 1.安装虚拟机 2.安装Docker 3.Docker镜像操作 4.Docker容器操作 Docker系列之常用命令操作手册 继上一篇博客Docker系列之原理简单介绍之后,本博客对常用的Doc ...

  5. go的三个常用命令go run go build go install

    go的三个常用命令 go run go build go install 命令源码文件:含有 main函数 的文件 库源码文件:不包含 main函数 的文件, 主要用于编译成静态文件.a供其他包调用 ...

  6. Docker入门之常用命令

    写在前面 细数当前最流行的技术莫过于容器化和人工智能了,而容器化技术能有今天的热度,Docker可谓功不可没. 让我们一起来回顾一下Docker 是什么? 是一种虚拟化技术 能够将应用程序自动部署到容 ...

  7. Docker三剑客之常用命令

    一.docker-machine 命令 说明 docker-machine create 创建一个 Docker 主机(常用-d virtualbox) docker-machine ls 查看所有的 ...

  8. Docker安装和常用命令

    Docker安装 Docker的安装可以参考 https://docs.docker.com/ 下面的 Get Docker / Docker CE / Linux, 需要关注的主要是CentOS和U ...

  9. Docker 安装与常用命令

    目录 Docker 安装 1)安装 2)启动 3)镜像加速器 Docker 常用命令 1)Docker 进程相关命令 2)Docker 镜像相关命令 docker search:查找镜像仓库中的镜像 ...

  10. Docker日常工作常用命令

    容器生命周期管理 Docker创建新容器并运行[run] 语法:docker run [OPTIONS] IMAGE [COMMAND] [ARG...] OPTIONS说明: -a stdin: 指 ...

随机推荐

  1. [前端开发]form-data和x-www-form-urlencoded的区别

    在后台开发时,之前做了文件的上传,用的是form-data,但并不知其区别.今天遇到了req.body为空的情况,切换成了x-www-form-urlencoded解决 form-data 就是htt ...

  2. Rocket - diplomacy - wirePrefix

    https://mp.weixin.qq.com/s/DVcA2UixnB_6vgI3SjZGyQ   调试wirePrefix方法.   1. 实现   wirePrefix用于调整名称格式,其实现 ...

  3. jchdl - RTL实例 - MOS6502 ALU (Verilog)

    https://mp.weixin.qq.com/s/jLUz757FQZjMEYzYb2AIww   MOS6502是简单,但是曾经相当流行的一款CPU.网上有很多模拟程序可供学习使用.这里使用一个 ...

  4. vim的常见操作

    vim常见操作 复制 yank, y yy:复制整行 nyy/yny y^/y0:复制当前行到行头的内容 y$:复制当前到行尾的内容 yw:复制一个word nyw/ynw 复制n个word yG:复 ...

  5. Linux (五) VIM编辑器

    个人博客网:https://wushaopei.github.io/    (你想要这里多有) 1.简介 ​ Linux系统环境下的一款非常重要的文本编辑工具,我们在Linux环境下几乎所有的文本文件 ...

  6. 判断IP地址的合法性

    每台计算机都有独一无二的编号,称为ip地址,每个合法的ip地址由‘.’分隔开的4个数字组成,每个数字的取值范围为0--255 输入一个字符串,判断其是否为合法的IP地址,若是输出‘YES’,否则输出‘ ...

  7. Java实现 蓝桥杯 算法提高 字符串匹配

    试题 算法提高 字符串匹配 问题描述 给出一个字符串和多行文字,在这些文字中找到字符串出现的那些行.你的程序还需支持大小写敏感选项:当选项打开时,表示同一个字母的大写和小写看作不同的字符:当选项关闭时 ...

  8. (Java实现) N皇后问题

    n皇后问题是一个以国际象棋为背景的问题:在n×n的国际象棋棋盘上放置n个皇后,使得任何一个皇后都无法直接吃掉其他的皇后,即任意两个皇后都不能处于同一条横行.纵行或斜线上. 蛮力法思想: 解决n皇后问题 ...

  9. Java实现 LeetCode 485 最大连续1的个数

    485. 最大连续1的个数 给定一个二进制数组, 计算其中最大连续1的个数. 示例 1: 输入: [1,1,0,1,1,1] 输出: 3 解释: 开头的两位和最后的三位都是连续1,所以最大连续1的个数 ...

  10. install-package : 由于无法加载项目 mydemo 的详细信息,操作失败

    安装nuget package包提示错误 install-package : 由于无法加载项目 mydemo 的详细信息,操作失败 解决方法 项目用dotnet cli 命令dotnet new mv ...