当前位置:网站首页>容器常用命令
容器常用命令
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 -镜像用户/镜像名:镜像版本号
边栏推荐
- 1025 pat ranking (25 points)
- Basic literacy - four common software architectures
- Text matching - [naacl 2022] GPL
- Start your global dynamic acceleration journey of Web services in three steps
- 1077 kuchiguse (20 points)
- How to program and process such parts?
- day02
- 1018 public bike Management (30 points)
- 1082 read number in Chinese (25 points)
- Web technology sharing | whiteboard toolbar encapsulation of Web
猜你喜欢
Complement (Niuke)
001 data type [basic]
CCF elimination games (Full Score code + problem solving ideas + skill summary) February 2, 2015
Xiao Sha's pain (thinking problem)
Four solutions to cross domain problems
Talk about why I started technical writing
Matlab construction operation example
Bye civil engineering, hello CS, can you change the certificate to the Blue Bridge Cup
Matlab judge palindrome number (only numbers)
Super comprehensive redis distributed high availability solution: sentry mechanism
随机推荐
1105 spiral matrix (25 points)
Abstract meaning
day02
Matlab function for limit, definite integral, first-order derivative, second-order derivative (classic examples)
Industry analysis | the future of real-time audio and video
1107 social clusters (30 points)
How should we understand the variability of architecture design?
Anyrtc implements application scenarios based on webrtc
001 data type [basic]
FoxPro and I
K - rochambau (joint search, enumeration)
Single cycle CPU of the design group of West University of Technology
Guada digital analog
G - navigation nightare
How to do a good job in high concurrency system design? I have summarized three points
Don't fight for big companies
1082 read number in Chinese (25 points)
The principle of fluent 2 rendering and how to realize video rendering
1077 kuchiguse (20 points)
Super comprehensive redis distributed high availability solution: sentry mechanism