Docker windows版入门

给registry安排mirrors

Docker daemon中加上

    "registry-mirrors": [
    "https://docker.mirrors.ustc.edu.cn",
    "https://registry.docker-cn.com" ]

registry.docker-cn.com这个是官方的中国镜像但好像不好用,还是ustc的好用。

Image和contianer之间的关系

Image是镜像,更多偏向于一个环境包,这个环境包可以移动到任意的Docker平台中去运行。

镜像提供容器运行时所需的程序、库、资源、配置等文件外,还包含了一些为运行时准备的一些配置参数(如匿名卷、环境变量、用户等)

一个镜像可以启动任意多个容器(contianer)

what is a container? Simply put, a container is simply another process on your machine that has been isolated from all other processes on the host machine.

肯定先有image后有container,那如何创建Image镜像?

使用DockerFile,切换到dockerfile所在的根目录,docker build -t getting-started .

-t  flag tags our image. Think of this simply as a human-readable name for the final image. 

we named the image getting-started

The . at the end of the docker build command tells that Docker should look for the Dockerfile in the current directory.

下一步,run一个contianer

tart your container using the docker run command and specify the name of the image we just created:

docker run -dp 3000:3000 getting-started

Remember the -d and -p flags? We're running the new container in "detached" mode (in the background) and creating a mapping between the host's port 3000 to the container's port 3000. Without the port mapping, we wouldn't be able to access the application.

After a few seconds, open your web browser to http://localhost:3000 

这个时候,默认run的是dockerfile,CMD那一行的命令。 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值