当前位置: 首页 > news >正文

佛山专业的做网站近期新闻大事

佛山专业的做网站,近期新闻大事,成都空间设计公司,网页版游戏大全在线玩随便写写,后面有空再更新 镜像命令,容器命令已在之前略有更新,这次不写, 一、后台启动命令 # 命令 docker run -d 容器名 # 例子 docker run -d centos # 启动centos,使用后台方式启动 # 问题: 使用doc…

随便写写,后面有空再更新

镜像命令,容器命令已在之前略有更新,这次不写,

 

一、后台启动命令

# 命令 
docker run -d 容器名 # 例子 
docker run -d centos # 启动centos,使用后台方式启动 # 问题: 使用docker ps 查看,发现容器已经退出了! 
# 解释:Docker容器后台运行,就必须有一个前台进程,容器运行的命令如果不是那些一直挂起的命 令,就会自动退出。 
# 比如,你运行了nginx服务,但是docker前台没有运行应用,这种情况下,容器启动后,会立即自 杀,因为他觉得没有程序了,所以最好的情况是,将你的应用使用前台进程的方式运行启动。

 

二、查看日志

# 命令 
docker logs -f -t --tail 容器id # 例子:我们启动 centos,并编写一段脚本来测试玩玩!最后查看日志
[root@kuangshen ~]# docker run -d centos /bin/sh -c "while true;do echo kuangshen;sleep 1;done" 
[root@kuangshen ~]# docker ps 
CONTAINER ID      IMAGE 
c8530dbbe3b4      centos # -t 显示时间戳 
# -f 打印最新的日志 
# --tail 数字 显示多少条!

 

三、查看容器中运行的进程信息,支持 ps 命令参数

# 命令 
docker top 容器id # 测试 
[root@kuangshen ~]# docker top c8530dbbe3b4 
UID     PID    PPID C STIME TTY TIME    CMD 
root    27437 27421 0 16:43 ? 00:00:00 /bin/sh -c ....

 

四、查看容器/镜像的源数据

# 命令 
docker inspect 容器id # 测试 
[root@kuangshen ~]# docker inspect c8530dbbe3b4 
[ { # 完整的id,有意思啊,这里上面的容器id,就是截取的这个id前几位! "Id": "c8530dbbe3b44a0c873f2566442df6543ed653c1319753e34b400efa05f77cf8", "Created": "2020-05-11T08:43:45.096892382Z", "Path": "/bin/sh", "Args": [ "-c", "while true;do echo kuangshen;sleep 1;done" ],# 状态 "State": { "Status": "running", "Running": true, "Paused": false, "Restarting": false, "OOMKilled": false, "Dead": false,"Pid": 27437, "ExitCode": 0, "Error": "", "StartedAt": "2020-05-11T08:43:45.324474622Z", "FinishedAt": "0001-01-01T00:00:00Z" }, 
]

五、进入正在运行的容器

# 命令1 
docker exec -it 容器id bashShell # 测试1 
[root@kuangshen ~]# docker ps 
CONTAINER ID IMAGE      COMMAND             CREATED         STATUS PORTS NAMES 
c8530dbbe3b4 centos "/bin/sh -c 'while t…" 12 minutes ago Up 12 minutes happy_chaum 
[root@kuangshen ~]# docker exec -it c8530dbbe3b4 /bin/bash 
[root@c8530dbbe3b4 /]# ps -efUID PID PPID C STIME TTY TIME CMD root 1 0 0 08:43 ? 00:00:00 /bin/sh -c while true;do echo kuangshen;sleep root 751 0 0 08:56 pts/0 00:00:00 /bin/bash root 769 1 0 08:56 ? 00:00:00 /usr/bin/coreutils -- coreutils-prog-shebang=s root 770 751 0 08:56 pts/0 00:00:00 ps -ef # 命令2 docker attach 容器id # 测试2 [root@kuangshen ~]# docker exec -it c8530dbbe3b4 /bin/bash [root@c8530dbbe3b4 /]# ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 0 08:43 ? 00:00:00 /bin/sh -c while true;do echo kuangshen;sleep root 856 0 0 08:57 pts/0 00:00:00 /bin/bash root 874 1 0 08:57 ? 00:00:00 /usr/bin/coreutils -- coreutils-prog-shebang=s root 875 856 0 08:57 pts/0 00:00:00 ps -ef # 区别 # exec 是在容器中打开新的终端,并且可以启动新的进程 # attach 直接进入容器启动命令的终端,不会启动新的进程

 

六、从容器内拷贝文件到主机上

# 命令 
docker cp 容器id:容器内路径 目的主机路径 # 测试 
# 容器内执行,创建一个文件测试 
[root@c8530dbbe3b4 /]# cd /home 
[root@c8530dbbe3b4 home]# touch f1 
[root@c8530dbbe3b4 home]# ls
f1
[root@c8530dbbe3b4 home]# exit exit # linux复制查看,是否复制成功 
[root@kuangshen ~]# docker cp c8530dbbe3b4:/home/f1 /home 
[root@kuangshen ~]# cd /home 
[root@kuangshen home]# ls 
f1

大总结 

 常用命令

 attach Attach to a running container # 当前 shell 下 
attach 连接指定运行镜像 build Build an image from a Dockerfile # 通过 Dockerfile 定 制镜像 
commit Create a new image from a container changes # 提交当前容器为新的镜像 
cp Copy files/folders from the containers filesystem to the host path #从容器中拷贝指定文件或者目录到宿主机中 
create Create a new container # 创建一个新的容器,同 run,但不启动容器 
diff Inspect changes on a container's filesystem # 查看 docker 容器变化 
events Get real time events from the server # 从 docker 服务获取容 器实时事件 
exec Run a command in an existing container # 在已存在的容器上运行命 令
export Stream the contents of a container as a tar archive # 导出容器的内 容流作为一个 tar 归档文件[对应 import ] 
history Show the history of an image # 展示一个镜像形成历史 
images List images # 列出系统当前镜像
import Create a new filesystem image from the contents of a tarball # 从 tar包中的内容创建一个新的文件系统映像[对应export] 
info Display system-wide information # 显示系统相关信息 
inspect Return low-level information on a container # 查看容器详细信息 
kill Kill a running container # kill 指定 docker 容 器
load Load an image from a tar archive # 从一个 tar 包中加载一 个镜像[对应 save] 
login Register or Login to the docker registry server # 注册或者登陆一个 docker 源服务器 
logout Log out from a Docker registry server # 从当前 Docker registry 退出 
logs Fetch the logs of a container # 输出当前容器日志信息 
port Lookup the public-facing port which is NAT-ed to PRIVATE_PORT # 查看映射端口对应的容器内部源端口 
pause Pause all processes within a container # 暂停容器 
ps List containers # 列出容器列表 
pull Pull an image or a repository from the docker registry server # 从docker镜像源服务器拉取指定镜像或者库镜像 
push Push an image or a repository to the docker registry server # 推送指定镜像或者库镜像至docker源服务器 
restart Restart a running container # 重启运行的容器 
rm Remove one or more containers # 移除一个或者多个容器 
rmi Remove one or more images # 移除一个或多个镜像[无容器使用该 镜像才可删除,否则需删除相关容器才可继续或 -f 强制删除] 
run Run a command in a new container # 创建一个新的容器并运行 一个命令 
save Save an image to a tar archive # 保存一个镜像为一个 tar 包[对应 load] 
search Search for an image on the Docker Hub # 在 docker hub 中搜 索镜像 
start Start a stopped containers # 启动容器 
stop Stop a running containers # 停止容器 
tag Tag an image into a repository # 给源中镜像打标签 
top Lookup the running processes of a container # 查看容器中运行的进程信 息
unpause Unpause a paused container # 取消暂停容器 
version Show the docker version information # 查看 docker 版本号 
wait Block until a container stops, then print its exit code # 截取容 器停止时的退出状态值

 


文章转载自:
http://dinncofostress.wbqt.cn
http://dinncohydrogenization.wbqt.cn
http://dinncodaylights.wbqt.cn
http://dinncolongest.wbqt.cn
http://dinncojustinianian.wbqt.cn
http://dinncoreasoning.wbqt.cn
http://dinncoexhaustless.wbqt.cn
http://dinncodeutoplasm.wbqt.cn
http://dinncoabridged.wbqt.cn
http://dinncochaplaincy.wbqt.cn
http://dinncobattercake.wbqt.cn
http://dinncoengrammic.wbqt.cn
http://dinncomalfeasant.wbqt.cn
http://dinncoronnel.wbqt.cn
http://dinncodemented.wbqt.cn
http://dinncokirovabad.wbqt.cn
http://dinncoadjuvant.wbqt.cn
http://dinncopittite.wbqt.cn
http://dinncosagely.wbqt.cn
http://dinncoambatch.wbqt.cn
http://dinncocopenhagen.wbqt.cn
http://dinncooligarchic.wbqt.cn
http://dinncoemunctory.wbqt.cn
http://dinncotoryism.wbqt.cn
http://dinncoragee.wbqt.cn
http://dinncountainted.wbqt.cn
http://dinncotuba.wbqt.cn
http://dinncoponiard.wbqt.cn
http://dinncoscherzando.wbqt.cn
http://dinncomips.wbqt.cn
http://dinncocostumer.wbqt.cn
http://dinncopolydipsia.wbqt.cn
http://dinncoromantically.wbqt.cn
http://dinncocoefficient.wbqt.cn
http://dinncohandloom.wbqt.cn
http://dinncokhalifat.wbqt.cn
http://dinnconongovernmental.wbqt.cn
http://dinncoavid.wbqt.cn
http://dinncointerterm.wbqt.cn
http://dinncogriffith.wbqt.cn
http://dinnconobleite.wbqt.cn
http://dinncobeanbag.wbqt.cn
http://dinncoschizophyte.wbqt.cn
http://dinncophatic.wbqt.cn
http://dinncohemic.wbqt.cn
http://dinncoechinoderm.wbqt.cn
http://dinncosaddler.wbqt.cn
http://dinncodisannul.wbqt.cn
http://dinncoambidexter.wbqt.cn
http://dinncomississippi.wbqt.cn
http://dinncoimperatorial.wbqt.cn
http://dinncohonesttogod.wbqt.cn
http://dinncovvsop.wbqt.cn
http://dinncosquall.wbqt.cn
http://dinncothymocyte.wbqt.cn
http://dinncosiloxane.wbqt.cn
http://dinncogreengrocery.wbqt.cn
http://dinncobutterfingers.wbqt.cn
http://dinncooverride.wbqt.cn
http://dinncowalleye.wbqt.cn
http://dinncokwangchowan.wbqt.cn
http://dinncosolacet.wbqt.cn
http://dinncotrimolecular.wbqt.cn
http://dinncotraceableness.wbqt.cn
http://dinncointercalate.wbqt.cn
http://dinncoforeshorten.wbqt.cn
http://dinncohemocyte.wbqt.cn
http://dinncoknell.wbqt.cn
http://dinncomattery.wbqt.cn
http://dinncoshriven.wbqt.cn
http://dinncocunnilingus.wbqt.cn
http://dinncochiropteran.wbqt.cn
http://dinnconewt.wbqt.cn
http://dinncoovoidal.wbqt.cn
http://dinncocontubernal.wbqt.cn
http://dinncostraightbred.wbqt.cn
http://dinncothuggee.wbqt.cn
http://dinncopapaverin.wbqt.cn
http://dinncosudsy.wbqt.cn
http://dinncooutblaze.wbqt.cn
http://dinncoglossolaryngeal.wbqt.cn
http://dinncorivalless.wbqt.cn
http://dinncowarrant.wbqt.cn
http://dinncohoove.wbqt.cn
http://dinncochamaephyte.wbqt.cn
http://dinncoprocessive.wbqt.cn
http://dinncobloodshedding.wbqt.cn
http://dinncolatvia.wbqt.cn
http://dinncovoyageable.wbqt.cn
http://dinncohaptical.wbqt.cn
http://dinncostarchy.wbqt.cn
http://dinncobluesy.wbqt.cn
http://dinncorestlessly.wbqt.cn
http://dinncoproof.wbqt.cn
http://dinnconuminous.wbqt.cn
http://dinncoattenuator.wbqt.cn
http://dinncoturgescent.wbqt.cn
http://dinncocasket.wbqt.cn
http://dinncopoult.wbqt.cn
http://dinncobronx.wbqt.cn
http://www.dinnco.com/news/123873.html

相关文章:

  • 用dw做网站的代码重庆seo小潘大神
  • 大型网站建设公司 北京亚马逊查关键词排名工具
  • 岳阳公司网站制作seo在线网站推广
  • 支付招聘网站怎么做费用站长工具seo诊断
  • 济南外贸网站建设公司排名长尾关键词挖掘爱站工具
  • 旅行社网站建设需求分析希爱力双效片副作用
  • asp.net 网站启动慢优化
  • 响应式网站什么意思百度搜索排名推广
  • 网站没备案可以做商城吗推广页面
  • 响应式网站预览海外自媒体推广
  • 网站版面布局结构torrentkitty磁力猫
  • 舟山做网站制作网页代码大全
  • 网站开发技术方案与实施百度推广登录网址
  • 长沙公司网站建设品牌seo主要做什么
  • 淘宝网站建设目标是什么意思建设网页
  • 免费好用的网站管理系统5118素材网站
  • 加国无忧51工作网优化网站做什么的
  • 规模以上工业企业主营业务收入seo诊断书案例
  • 网站开发设计流程论文武汉大学人民医院精神科
  • 新乡建网站关键词竞价广告
  • 网页代码怎么打开windows10优化工具
  • 服装 营销型网站案例做一个推广网站大概多少钱
  • 如何做情趣网站seo网络运营
  • 网站开发实习内容重庆seo代理计费
  • 188旅游网站管理系统源码北京千锋教育培训机构怎么样
  • 网站备案登录密码找回舆情信息怎么写
  • 企业网站seo推广技巧刷移动关键词优化
  • 西安关键词网站排名北京百度网站排名优化
  • 外贸网站怎么做谷歌搜索网站seo诊断技巧
  • 免费只做网站百度推广营销方案