Docker(三)Docker常用命令

时间:2022-09-02 22:52:06

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(三)Docker常用命令

删除镜像

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 的基本概念和常用命令. 基本概念 镜像 Image 镜像是一些打包好的已有的环境,可以被用来启动和创建容器 容器 Contai ...

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

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

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

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

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

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

  5. Docker入门之常用命令

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

  6. Docker三剑客之常用命令

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

  7. Docker安装和常用命令

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

  8. Docker 安装与常用命令

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

  9. &lbrack;转&rsqb;Docker&lpar;三&rpar;:Dockerfile 命令详解

    本文转自:https://blog.csdn.net/ityouknow/article/details/79600406 上一篇文章Docker(二):Dockerfile 使用介绍介绍了 Dock ...

  10. Docker&lpar;三&rpar;:Dockerfile 命令详解

    上一篇文章Docker(二):Dockerfile 使用介绍介绍了 Dockerfile 的使用,这篇文章我们来继续了解 Dockerfile ,学习 Dockerfile 各种命令的使用. Dock ...

随机推荐

  1. iOS 编译时的警告导致无法通过编译

    今天编译react native的代码,发现了2个警告,但是系统却当做错误,不能编译成功,查看了一下编译选项,看到了如下配置: 注意到这个-Werror 了吗? 就是这个标志导致系统把所有的 警告都当 ...

  2. 介绍一种基于gulp对seajs的模块做合并压缩的方式

    之前的项目一直采用grunt来构建,然后用requirejs做模块化,requirejs官方有提供grunt的插件来做压缩合并.现在的项目切到了gulp,模块化用起了seajs,自然而然地也想到了模块 ...

  3. Enum遇到下拉框

    package com.zj.tool; public enum WeekDay { Mon(), Tue(), Wed(), Thu(), Fri(), Sat(), Sun(); /**定义枚举类 ...

  4. nginx和fpm的进程数配置和502,504错误

    502 和 php-fpm.conf 1.php-cgi进程数不够用.php执行时间长,导致没有空闲进程处理新请求. 2.php-cgi进程死掉.php-fpm超时时间短,当前进程执行超时关闭连接. ...

  5. dpkg用法详解

    dpkg是一个Debian的一个命令行工具,它可以用来安装.删除.构建和管理Debian的软件包. 下面是它的一些命令解释: 1)安装软件 命令行:dpkg -i <.deb file name ...

  6. Windows 10 IoT Core Samples

    Windows 10 IoT Core Samples Welcome to the Windows 10 IoT Core Samples These samples have been valid ...

  7. 为iOS7重新设计你的App

    在 WWDC 上看到 iOS 7 系统的发布后,我们重新审视了自己的应用 Grocery List,并且意识到:iOS 7 对于开发者来说是一个全新的开始,就像七年前 iPhone 首次发布一样.现在 ...

  8. iOS开发——model类模板(过滤null和ID)

            说明:model类模板已默认过滤null值,附加特殊情况的关键字ID名的冲突(需手动去掉注释代码).MyMessageModel为示例的名字.可以自己随便起. 1.自己创建一个继承与N ...

  9. STL之vector(向量)

    C++编程语言中有一种叫做Vector的应用方法,它的作用在实际编程中是非常重要的,这里详细介绍一下C++ Vector的相关应用技巧及基本内容: Construct vector #include ...

  10. shell脚本编写步骤及其常用命令和符号

    1,什么是Shell     Shell 是kernel的一个外壳,是一个命令解析器,负责用户与内核的交互.2,Shell脚本     Shell脚本类似于批处理,可以方便的执行大量命令.3,编写sh ...