当前位置:网站首页>容器常用命令
容器常用命令
2022-06-30 15:33:00 【哥哥的梦】
新建+启动容器
docker run [OPTIONS] IMAGE [COMMAND] [ARG…]
options常用选项说明:
–name=‘容器新名字’ 为容器指定一个名称
-d 后台运行容器并返回容器ID,也既启动守护式容器(后台运行)
-i 以交互式模式运行容器,通常与-t同时使用
-t 为容器重新分配一个伪输入终端,通常与-i同时使用,也即启动交互式容器(前台有伪终端,等待交互)
-P 随机端口映射
-p 指定端口映射
docker ps [OPTIONS]
options常用选项
-a 列出当前所有正在运行的容器+历史上运行过的
-l 显示最近创建的容器
-n 显示最近n个创建的容器
-q 静默模式,只显示容器编号
退出容器命令
1.exit run进去,exit退出,容器停止
2.Ctrl+p+q run进去,退出容器不停止
启动已停止的容器
docker start 容器ID或者容器名
重启容器
docker restart 容器ID或者容器名
停止容器
docker stop 容器ID或者容器名
强制停止容器
docker kill 容器ID或者容器名
删除已停止的容器
docker rm 容器ID或者容器名
查看容器日志
docker logs 容器ID
查看容器内运行的进程
docker top 容器ID
查看docker容器内部细节
docker inspect 容器ID
重新进入容器的命令
1.docker exec -it 容器ID bashshell 推荐使用这种退出方式
docker attach 容器ID
从容器内拷贝文件到主机上
docker cp 容器ID:容器内路径 目的主机路径
导入和导出容器
docker export 容器ID > 文件.tar
cat 文件名.tar | docker import -镜像用户/镜像名:镜像版本号
边栏推荐
- 1058 a+b in Hogwarts (20 points)
- day02
- String connector
- Svn password forgetting solution
- Expressions in if statements
- DR-TANet: Dynamic Receptive Temporal Attention Network for Street Scene Change Detection
- 1136: password translation
- One dimensional and two dimensional array addresses
- On which platform is it safer to buy Treasury reverse repo?
- 1027 colors in Mars (20 points)
猜你喜欢

Talk about why I started technical writing

The sound network has fully opened the real-time transmission network sd-rtn, which has been free of network wide accidents for seven years - this is FPA!

Chapter III installation and use of jupyter

Explain service idempotency design in detail

4.12 input() input function and comments

Four solutions to cross domain problems

Rte2021 review of the practice and the way of AI OPS landing

4.4 string

Matlab judge palindrome number (only numbers)

Npumcm selection question 3 and acmc2020a
随机推荐
My own opinion on lisp
Expressions in if statements
How does sd-rtn ensure the high availability of RTE services after infrastructure failure
G - building a space station
It's so brain - burning that no wonder programmers lose their hair
Bucket sorting (C language)
先锋期货安全么?现在期货开户都是哪些流程?期货手续费怎么降低?
IO interview questions
Win10 backup backup shows that creating a shared protection point on the shadow failed
4.3 variables and assignments
1066 root of AVL tree (25 points)
RTC monthly tabloid programming challenge ended successfully in June; Review of the first anniversary of sound network's listing
CCF elimination games (Full Score code + problem solving ideas + skill summary) February 2, 2015
1130: find the first character that appears only once
文本匹配——【NAACL 2021】AugSBERT
H - Arctic network (minimum spanning tree)
What would you choose between architecture optimization and business iteration?
Xiao Sha's pain (thinking problem)
Four solutions to cross domain problems
001 basic knowledge (unfinished)