虽然我们接下来还是会介绍很多概念,但是最好还是提前了解什么是Docker,和为什么你会使用Docker。
对容器的简短的解释镜像是轻量的,独立的,可执行的包,并且包含了软件运行需要的所有东西,包括:代码,运行环境,各种库,环境变量,配置文件等。 容器是一个镜像的运行实例——也就是镜像被加载到内存,并且真的被执行之后。默认情况下,容器和宿主机是完全隔离的,最多也只会在配置了的情况下,使用宿主机的hosts文件和端口。 容器会把应用直接运行在宿主机的内核中,这样会比虚拟机有更好的性能,因为虚拟机只能通过hypervisor(超级监督者)来间接的使用宿主机资源的虚拟权限。容器可以获得原生的资源使用权限,每个都运行在独立的进程中,不需要额外的内存。 虚拟机示意图
容器示意图
设置在设置之前,请先确保你已经暗转挂了最新版本的Docker。安装
如果安装完了,可以尝试运行 ➜ ~ docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world b04784fba78d: Pull complete Digest: sha256:f3b3b28a45160805bb16542c9531888519430e9e6d6ffc09d72261b0d26ff74f Status: Downloaded newer image for hello-world:latest 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. 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://cloud./ For more examples and ideas, visit: https://docs./engine/userguide/ 在看看版本是否满足要求,使用 ➜ ~ docker --version Docker version 17.05.0-ce-rc1, build 2878a85 如果你运行得到的结果和我的类似,那就可以愉快的使用Docker来玩耍了。 来源:https://www./content-4-863401.html |
|