Docker入门

docker安装

docker提供了同种安装方式

1.从Docker的apt源安装

此方法感觉有点复杂 没用过

2.curl安装
网站https://get.docker.com提供了curl-able的安装脚本install.sh,我们可以通过curl的方式进行安装docker。我们先安装curl,

$ sudo apt-get update
$ sudo apt-get install curl

然后运行下面命令安装docker,

$ curl -k -sSl https://get.docker.com | sudo sh

Docker验证

Docker安装结束后,我们来验证以下docker的功能。官方的Docker Hub提供了hello-world的镜像,我们可以通过该镜像起一个容器来验证我们已正确安装了docker。
Docker安装结束后,我们来验证以下docker的功能。官方的Docker Hub提供了hello-world的镜像,我们可以通过该镜像起一个容器来验证我们已正确安装了docker。

enfu ~ $ sudo 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.
  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 Hub account:
https://hub.docker.com

For more examples and ideas, visit:
https://docs.docker.com/userguide/
出现上面打印信息表示,docker已正常工作。

基本操作

搭建开发环境

你可能感兴趣的:(Docker入门)