Docker¶
docker是什么?¶
Docker是一种能够运行在windows、linux和Mac os上的软件,用于管理创建和编排容器。Docker是在Github上开发的Moby开源项目的一部分。Docker公司,位于旧金山,是整个Moby开源项目的维护者。Docker公司还提供包含支持服务的商业版本的Docker。
Docker的安装¶
windows11平台上的安装。¶
选择适合的平台下载相应的安装文件。
windows版的docker是一个社区版本(Community Edition,CE)的应用,并不是为生产环境设计的。
本文的安装环境为windows11专业版。这也是笔者第一次尝试安装在windows11上。并未做深入的测试,理论上win10上的安装类似。
对于在windows平台上安装Docker必须满足一下几点。
- windows必须是64bit
- windows必须支持hyper-v和容器特性
- 电脑硬件平台需要开启虚拟化VT-X
需要确认已在在window平台上开启hyper-v和容器特性。
在docker官方网站下载docker安装包。并执行安装运行即可。
安装成功以后在windows平台上使用终端工具输入
查看是否安装成功。
在linux平台上安装Docker(以Centos为例)¶
安装docker
启动docker
测试docker是否正常安装
title="<custom title>"
[root@centos-docker ~]# docker run 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
在Mac os上安装Docker¶
下载Docker应用
graph LR
A[Start] --> B{Error?};
B -->|Yes| C[Hmm...];
C --> D[Debug];
D --> B;
B ---->|No| E[Yay!];
- [ ]
- [x]
- [x] Lorem ipsum dolor sit amet, consectetur adipiscing elit
- [ ] Vestibulum convallis sit amet nisi a tincidunt
* [x] In hac habitasse platea dictumst
* [x] In scelerisque nibh non dolor mollis congue sed et metus
* [ ] Praesent sed risus massa
- [ ] Aenean pretium efficitur erat, donec pharetra, ligula non scelerisque