docker basic guide


  1. install docker apt-get install docker
    also works wget -qO- https://get.docker.com/ | sh
  2. run hello-world image docker run hello-world

docker tells os you are using docker program
run a subcommand that creates & run a Docker container
hello-world tells docker which image to load into the container

(1)find it locally
(2)if not available,find it on the hub
(3)load the image into the container and ran it

  • find image whick you want on the hub
  • list your local images docker images
  • build your own image
    (1) write a Dockerfile, add lines to the file like this:
    [1]FROM docker/whalesay:latest
    whick image your image is based on.
    [2]RUN apt-get -y update && apt-get install -y fortunes
    add the fortunes program to the image.
    [3]CMD /usr/games/fortune -a | cowsay
    tells the fortunes program to pass a nifty quote to the cowsay program.
    (2) build an imange from your Dockerfile
    • docker bulid -t docker-whale . (don’t forget . period)
      this command takes the Dockerfile in the current dir,and bulids an imge called docker-whale on your local machine.
  • list your new images
  • tag,push ,and pull your image
    (1) tag and push the image
    docker images list images on your local machine, and pick up the IMAGE ID specified.
    • docker tag 5452ad69d37f zhangjianbo1989/docker-whale:latest

      docker use the docker program
      tag a subcommand that tags an image
      5452ad69d37f IMAGE ID
      zhangjianbo1989 your account name from Docker Hub.
      docker-whale the image name
      latest version label

  • push your image to your repository on the hub.
    docker push zhangjianbo1989/docker-whale
  • delete images from your local machine
    docker rmi
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值