Y 分钟速成 docker
源代码下载: docker-cn.bat
:: 下载、安装、运行 hello-world 镜像(image)
docker run hello-world
:: :: 如果这是第一次运行,你应该能见到这些信息
:: Unable to find image 'hello-world:latest' locally # 在本地找不到镜像xxx
:: latest: Pulling from library/hello-world
:: 1b930d010525: Pull complete
:: Digest: sha256:4fe721ccc2e8dc7362278a29dc660d833570ec2682f4e4194f4ee23e415e1064
:: Status: Downloaded newer image for hello-world:latest
::
:: Hello from Docker! # 来自Docker的欢迎
:: This message shows that your installation appears to be working correctly. # 此信息表明你的安装似乎成功了
::
:: To generate this message, Docker took the following steps: # Docker进行了如下步骤来产生此信息
:: 1. The Docker client contacted the Docker daemon. # Docker客户端联系Docker守护程序
:: 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. # Docker守护程序从Docker Hub拉取镜像
:: (amd64)
:: 3. The Docker daemon created a new container from that image which runs the # Docker守护程序从镜像中创建了一个容器
:: executable that produces the output you are currently reading. # 运行了产生你正在读的输出的可执行文件
:: 4. The Docker daemon streamed that output to the Docker client, which sent it # Docker守护程序把输出流式传输给Docker客户端,后者发送到你的终端上
:: to your terminal.
::
:: To try something more ambitious, you can run an Ubuntu container with: # 若要尝试更强大的东西,你可以用该命令运行Ubuntu容器
:: $ docker run -it ubuntu bash
::
:: Share images, automate workflows, and more with a free Docker ID: # 使用免费的Docker ID来分享镜像,自动化工作流等
:: https://hub.docker.com/
::
:: For more examples and ideas, visit: # 欲获取更多例子和想法,访问
:: https://docs.docker.com/get-started/
:: 现在来看看当前正运行的镜像
docker ps
:: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
:: NAMES
:: 看看之前运行过的镜像
docker ps -a
:: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
:: NAMES
:: 4a76281f9c53 hello-world "/hello" 2 minutes ago Exited (0) 2 minutes ago
:: happy_poincare
:: 名字(name)是自动生成的,因此它会和你的不同
:: 移除(remove)我们之前生成的镜像
docker rm happy_poincare
:: 测试是否真的删除了
docker ps -a
:: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
:: NAMES
:: 为容器(container)指定自定义名字
docker run --name test_container hello-world
:: Hello from Docker!
:: This message shows that your installation appears to be working correctly.
::
:: To generate this message, Docker took the following steps:
:: 1. The Docker client contacted the Docker daemon.
:: 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
:: (amd64)
:: 3. The Docker daemon created a new container from that image which runs the
:: executable that produces the output you are currently reading.
:: 4. The Docker daemon streamed that output to the Docker client, which sent it
:: to your terminal.
::
:: To try something more ambitious, you can run an Ubuntu container with:
:: $ docker run -it ubuntu bash
::
:: Share images, automate workflows, and more with a free Docker ID:
:: https://hub.docker.com/
::
:: For more examples and ideas, visit:
:: https://docs.docker.com/get-started/
docker ps -a
:: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
:: NAMES
:: d345fe1a4f41 hello-world "/hello" About a minute ago Exited (0) About a minute ago
:: test_container
:: 如你所见,名字现在是我们指定的了
:: 从命名过的容器中获取日志(logs)
docker logs test_container
:: Hello from Docker!
:: This message shows that your installation appears to be working correctly.
::
:: To generate this message, Docker took the following steps:
:: 1. The Docker client contacted the Docker daemon.
:: 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
:: (amd64)
:: 3. The Docker daemon created a new container from that image which runs the
:: executable that produces the output you are currently reading.
:: 4. The Docker daemon streamed that output to the Docker client, which sent it
:: to your terminal.
::
:: To try something more ambitious, you can run an Ubuntu container with:
:: $ docker run -it ubuntu bash
::
:: Share images, automate workflows, and more with a free Docker ID:
:: https://hub.docker.com/
::
:: For more examples and ideas, visit:
:: https://docs.docker.com/get-started/
docker rm test_container
docker run ubuntu
:: Unable to find image 'ubuntu:latest' locally
:: latest: Pulling from library/ubuntu
:: 2746a4a261c9: Pull complete
:: 4c1d20cdee96: Pull complete 0d3160e1d0de: Pull complete c8e37668deea: Pull complete Digest: sha256:250cc6f3f3ffc5cdaa9d8f4946ac79821aafb4d3afc93928f0de9336eba21aa4
:: Status: Downloaded newer image for ubuntu:latest
docker ps -a
:: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
:: NAMES
:: c19e9e5b000a ubuntu "/bin/bash" 5 seconds ago Exited (0) 4 seconds ago
:: relaxed_nobel
:: 在交互模式(interactive mode)下运行容器
docker run -it ubuntu
:: root@e2cac48323d2:/# uname
:: Linux
:: root@e2cac48323d2:/# exit
:: exit
docker rm relaxed_nobel
docker ps -a
:: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
:: NAMES
:: e2cac48323d2 ubuntu "/bin/bash" 2 minutes ago Exited (0) About a minute ago
:: nifty_goldwasser
docker rm nifty_goldwasser
有建议?或者发现什么错误?在Github上开一个 issue ,或者发起 pull request !
原著Ruslan López,并由 0 个好心人修改。
© 2022 Ruslan López
Translated by: imba-tjd
本作品采用 CC BY-SA 3.0 协议进行许可。
Learn X in Y minutes
Take a whirlwind tour of your next favorite language.
3 声望
4 粉丝
推荐阅读
Y 分钟速成 Git
源代码下载: gitGit 是一个分布式版本控制及源代码管理工具。Git 可以为你的项目保存若干快照,以此来对整个项目进行版本管理。版本什么是版本控制版本控制系统就是根据时间来记录一个或多个文件的更改情况的系...
小X学技术阅读 1.3k
Aliyun-使用Docker方式安装Jenkins
之前自己在阿里云ECS上面安装了Jekins(安装jenkins的文章),最近因为服务器中了挖矿木马于是准备重新安装一下,但是想到每次安装jenkins都要手动安装jdk、maven、docker、kubectl,感觉好麻烦,于是使用官方推荐...
Awbeci赞 2阅读 2.1k
蚂蚁安全科技 Nydus 镜像加速实践
蚂蚁安全科技 Nydus 镜像加速实践原创 曦栖 金融级分布式架构文|蚂蚁集团 ZOLOZ 团队使用全球领先安全科技,为用户和机构提供安全、便捷的安全风控解决方案。本文 6386 字 阅读 12 分钟背景简介ZOLOZ[1]是蚂蚁集...
SOFAStack赞 1阅读 3.8k
Win10 安装Docker以及Jenkins(超级详细篇)
安装Docker下载地址:[链接] ,按照它的指引教程,无脑下一步即可。安装成功后电脑会重启。打开docker桌面端,会显示进入链接,下载WSL 安装包进行无脑安装即可。安装 Linux 内核更新包 (重启电脑)重启 Docker ...
九旬赞 3阅读 1.1k
Redis集群容器化安装
主从复制在数据库中很常见,一般用来做读写分离,Redis中也是如此。要求只有1个Master(主节点),可以有N个slaver(从节点),而且Slaver也可以有自己的Slaver,由于这种主从的关系决定他们是在配置阶段就要指定...
KerryWu赞 2阅读 2.3k
LeanCloud 云引擎支持预览环境
云引擎最近支持了 预览环境,可以自动将 Pull request 部署到一个新的环境,每个预览环境有单独的域名,让开发者在线上测试过后再合并 PR。
LeanCloud赞 1阅读 1.5k
在 IDEA 中创建 Spring Boot 项目的方式(详细步骤教程)
开发环境以下是我的开发环境JDK 1.8Maven 3.6.3IDEA 2019(2019 无所畏惧,即使现在已经 2023 年了哈哈哈)使用 Maven 的方式创建 Spring Boot 项目下面的内容可能会因 IDEA 版本不同,而有些选项不同,但是大同...
god23bin赞 2阅读 648
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。