docker在centos上的安装和使用

来源:互联网 发布:淘宝网店计划 编辑:程序博客网 时间:2024/05/20 09:27
[root@localhost ~]# uname -r

3.10.0-229.el7.x86_64

[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 7.1.1503 (Core) 

安装docker 执行下面的yum指令

yum install docker    #用yum 指令安装,安装的docker和你linux kernel是适配的

启动docker服务

service docker start

ps一下看是否docker服务是否已经启动

[root@localhost ~]# ps auxf|grep docker
root      4771  0.0  0.0 112640   964 pts/0    S+   00:54   0:00          \_ grep --color=auto docker
root      1221  0.0  0.3 421508 13484 ?        Ssl  Nov07   0:53 /usr/bin/docker -d --selinux-enabled

或者执行以下命令,看是否能够得到docker help信息

[root@localhost ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
Trying to pull repository docker.io/library/hello-world ... latest: Pulling from library/hello-world
3f12c794407e: Pull complete 
975b84d108f1: Pull complete 
library/hello-world:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.


Digest: sha256:517f03be3f8169d84711c9ffb2b3235a4d27c1eb4ad147f6248c8040adb93113
Status: Downloaded newer image for docker.io/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 Hub account:
 https://hub.docker.com


For more examples and ideas, visit:
 https://docs.docker.com/userguide/

查一下有那些centos镜像

docker search centos

下载一个centos镜像

docker pull docker.io/layerworx/centos



0 0
原创粉丝点击