docker安装笔记

启动Docker

[root@localhost ~]# service docker start
Redirecting to /bin/systemctl start  docker.service

设置Docker开机启动

[root@localhost ~]# chkconfig docker on
注意:正在将请求转发到“systemctl enable docker.service”。
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

查看Docker版本

[root@localhost ~]# docker version
Client:
 Version:         1.10.3
 API version:     1.22
 Package version: docker-common-1.10.3-46.el7.centos.10.x86_64
 Go version:      go1.6.3
 Git commit:      d381c64-unsupported
 Built:           Thu Aug  4 13:21:17 2016
 OS/Arch:         linux/amd64

Server:
 Version:         1.10.3
 API version:     1.22
 Package version: docker-common-1.10.3-46.el7.centos.10.x86_64
 Go version:      go1.6.3
 Git commit:      d381c64-unsupported
 Built:           Thu Aug  4 13:21:17 2016
 OS/Arch:         linux/amd64

查看Docker运行信息(以下显示没有运行任何容器)

[root@localhost ~]# docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 1.10.3
Storage Driver: devicemapper
 Pool Name: docker-253:0-37085895-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 10.74 GB
 Backing Filesystem: xfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 11.8 MB
 Data Space Total: 107.4 GB
 Data Space Available: 10.39 GB
 Metadata Space Used: 581.6 kB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.147 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 WARNING: Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning.
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.107-RHEL7 (2015-10-14)
Execution Driver: native-0.2
Logging Driver: journald
Plugins: 
 Volume: local
 Network: null host bridge
Kernel Version: 3.10.0-327.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
Number of Docker Hooks: 2
CPUs: 4
Total Memory: 2.725 GiB
Name: localhost.localdomain
ID: VEU6:2CFP:7YW2:7Z6C:PXZJ:RQMX:D5DM:24IR:IAV5:XRI4:I5L7:HEF6
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Registries: docker.io (secure)

查询可下载容器ubuntu12.10

[root@localhost ~]# docker search ubuntu12.10
INDEX       NAME                                  DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
docker.io   docker.io/chug/ubuntu12.10x32         Ubuntu Quantal Quetzal 12.10 32bit  base i...   0                    
docker.io   docker.io/chug/ubuntu12.10x64         Ubuntu Quantal Quetzal 12.10 64bit  base i...   0                    
docker.io   docker.io/marcgibbons/ubuntu12.10                                                     0                    
docker.io   docker.io/mirolin/ubuntu12.10                                                         0                    
docker.io   docker.io/mirolin/ubuntu12.10_redis 

下载docker.io/chug/ubuntu12.10x64

[root@localhost ~]# docker pull docker.io/chug/ubuntu12.10x64
Using default tag: latest
Trying to pull repository docker.io/chug/ubuntu12.10x64 ... 
latest: Pulling from docker.io/chug/ubuntu12.10x64
ec7cd46b6ffd: Pull complete 
34a1faba1633: Pull complete 
Digest: sha256:55f51f09852c1d66dbae389a63c4eb5378e414dcb1f71525749761b26a4cd579
Status: Downloaded newer image for docker.io/chug/ubuntu12.10x64:latest

查看docker已下载镜像

[root@localhost ~]# docker images
REPOSITORY                      TAG                 IMAGE ID            CREATED             SIZE
docker.io/chug/ubuntu12.10x64   latest              29dabb67f0d8        2 years ago         270.3 MB

查询带LAMP的镜像

[root@localhost ~]# docker search centos
INDEX       NAME                                    DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
docker.io   docker.io/centos                        The official build of CentOS.                   2531      [OK]       
docker.io   docker.io/jdeathe/centos-ssh            CentOS-6 6.8 x86_64 / CentOS-7 7.2.1511 x8...   27                   [OK]
docker.io   docker.io/nimmis/java-centos            This is docker images of CentOS 7 with dif...   13                   [OK]
docker.io   docker.io/million12/centos-supervisor   Base CentOS-7 with supervisord launcher, h...   12                   [OK]
docker.io   docker.io/gluster/gluster-centos        Official GlusterFS Image [ CentOS7 +  Glus...   11                   [OK]
docker.io   docker.io/torusware/speedus-centos      Always updated official CentOS docker imag...   8                    [OK]
docker.io   docker.io/nickistre/centos-lamp         LAMP on centos setup                            4                    [OK]
docker.io   docker.io/centos/mariadb55-centos7                                                      3                    [OK]
docker.io   docker.io/nathonfowlie/centos-jre       Latest CentOS image with the JRE pre-insta...   3                    [OK]
docker.io   docker.io/consol/sakuli-centos-xfce     Sakuli end-2-end testing and monitoring co...   2                    [OK]
docker.io   docker.io/blacklabelops/centos          CentOS Base Image! Built and Updates Daily!     1                    [OK]
docker.io   docker.io/darksheer/centos              Base Centos Image -- Updated hourly             1                    [OK]
docker.io   docker.io/harisekhon/centos-java        Java on CentOS (OpenJDK, tags jre/jdk7-8)       1                    [OK]
docker.io   docker.io/timhughes/centos              Centos with systemd installed and running       1                    [OK]
docker.io   docker.io/aguamala/centos               CentOS base image                               0                    [OK]
docker.io   docker.io/dmglab/centos                 CentOS with some extras - This is for the ...   0                    [OK]
docker.io   docker.io/grayzone/centos               auto build for centos.                          0                    [OK]
docker.io   docker.io/grossws/centos                CentOS 6 and 7 base images with gosu and l...   0                    [OK]
docker.io   docker.io/harisekhon/centos-scala       Scala + CentOS (OpenJDK tags 2.10-jre7 - 2...   0                    [OK]
docker.io   docker.io/januswel/centos               yum update-ed CentOS image                      0                    [OK]
docker.io   docker.io/jsmigel/centos-epel           Docker base image of CentOS w/ EPEL installed   0                    [OK]
docker.io   docker.io/kz8s/centos                   Official CentOS plus epel-release               0                    [OK]
docker.io   docker.io/repositoryjp/centos           Docker Image for CentOS.                        0                    [OK]
docker.io   docker.io/smartentry/centos             CentOS with smartentry                          0                    [OK]
docker.io   docker.io/ustclug/centos                 USTC centos                                    0                    [OK]

下载docker.io/nickistre/centos-lamp

[root@localhost ~]# docker pull docker.io/nickistre/centos-lamp
Using default tag: latest
Trying to pull repository docker.io/nickistre/centos-lamp ... 
latest: Pulling from docker.io/nickistre/centos-lamp
a3ed95caeb02: Pull complete 
35d9d5d11536: Pull complete 
c422cdb256a9: Pull complete 
bd3dfdafe65b: Pull complete 
bd3462764183: Pull complete 
665c411390e3: Pull complete 
8fc0c0a1c4fe: Pull complete 
bc31532139f0: Pull complete 
555193311939: Pull complete 
50197e4977e2: Pull complete 
11cf2fa9714b: Pull complete 
88d7e466811c: Pull complete 
6969966ecc41: Pull complete 
f99014094379: Pull complete 
31ec0d0094d4: Pull complete 
54cfd34f58b8: Pull complete 
Digest: sha256:87e1376fe2e51fcfe67e854a8e96ed6d8caf356f7e83f01093819b0610482fe8
Status: Downloaded newer image for docker.io/nickistre/centos-lamp:latest

查询已下载镜像

[root@localhost ~]# docker images
REPOSITORY                        TAG                 IMAGE ID            CREATED             SIZE
docker.io/nickistre/centos-lamp   latest              b45f1e1c24ef        12 weeks ago        538.4 MB
docker.io/chug/ubuntu12.10x64     latest              29dabb67f0d8        2 years ago         270.3 MB

运行docker.io/nickistre/centos-lamp镜像

[root@localhost ~]# docker run -i -t docker.io/nickistre/centos-lamp
/usr/lib/python2.6/site-packages/supervisor/options.py:298: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
  'Supervisord is running as root and it is searching '
2016-08-12 01:54:38,603 CRIT Supervisor running as root (no user in config file)
2016-08-12 01:54:38,619 INFO RPC interface 'supervisor' initialized
2016-08-12 01:54:38,619 CRIT Server 'inet_http_server' running without any HTTP authentication checking
2016-08-12 01:54:38,619 INFO supervisord started with pid 1
2016-08-12 01:54:39,623 INFO spawned: 'httpd' with pid 10
2016-08-12 01:54:39,625 INFO spawned: 'sshd' with pid 11
2016-08-12 01:54:39,633 INFO spawned: 'mysql' with pid 12
2016-08-12 01:54:40,790 INFO success: httpd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2016-08-12 01:54:40,790 INFO success: sshd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2016-08-12 01:54:40,790 INFO success: mysql entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

你可能感兴趣的:(新运维架构)