docker命令简集

1.获取container信息:sudo docker ps
2.openface的container名字:unruffled_montalcini
所以可用:sudo docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' unruffled_montalcini获取其docker ip
3.官方提供的使用docker运行openface的命令:sudo docker run -v /home/sunyu:/host/Users -p 9000:9000 -p 8000:8000 -t -i bamos/openface /bin/bash
退出:ctrl+d


 # 在容器中运行"echo"命令,输出"hello word"  
$docker run image_name echo "hello word"  


# 交互式进入容器中  
$docker run -i -t image_name /bin/bash  

# 在容器中安装新的程序
$docker run image_name apt-get install -y app_name


进入自己保存工作的容器:
sudo docker run -v /home/sunyu:/host/Users -p 9000:9000 -p 8000:8000 -t -i face /bin/bash


保存本次对容器操作:
    # 先通过sudo docker ps 获取container ID.
    # 保存对容器的修改; -a, --author="" Author; -m, --message="" Commit message  
    docker commit ID new_image_name  


保存和加载镜像(save、load)
# 保存镜像到一个tar包; -o, --output="" Write to an file  
$docker save image_name -o file_path  

# 加载一个tar包格式的镜像; -i, --input="" Read from a tar archive file  
$docker load -i file_path  

# 机器a  
$docker save image_name > /home/save.tar  

# 使用scp将save.tar拷到机器b上,然后:  
$docker load < /home/save.tar


根据Dockerfile 构建出一个容器
 #build  
      --no-cache=false Do not use cache when building the image  
      -q, --quiet=false Suppress the verbose output generated by the containers  
      --rm=true Remove intermediate containers after a successful build  
      -t, --tag="" Repository name (and optionally a tag) to be applied to the resulting image in case of success  
$docker build -t image_name Dockerfile_path




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值