热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

centos7上安装DUCKER并配置

Lastlogin:TueFeb715:17:322017安装docker[root@localhost~]#yuminstalldockerComplete!启动
Last login: Tue Feb  7 15:17:32 2017
//安装docker
[root@localhost ~]# yum install docker
Complete!
//启动docker
[root@localhost ~]# systemctl start docker.service
//配置开机自启动docker
[root@localhost ~]# 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 ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
//查询官方docker hub 的镜像
[root@localhost ~]# docker search mysql
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/mysql MySQL is a widely used, open-source relati... 3815 [OK]
docker.io docker.io/mysql/mysql-server Optimized MySQL Server Docker images. Crea... 253 [OK]
docker.io docker.io/centurylink/mysql Image containing mysql. Optimized to be li... 48 [OK]
docker.io docker.io/sameersbn/mysql 41 [OK]
docker.io docker.io/zabbix/zabbix-server-mysql Zabbix Server with MySQL database support 25 [OK]
docker.io docker.io/appcontainers/mysql Centos/Debian Based Customizable MySQL Con... 8 [OK]
docker.io docker.io/marvambass/mysql MySQL Server based on Ubuntu 14.04 7 [OK]
docker.io docker.io/dnhsoft/mysql-utf8 Inherits the official MySQL image configur... 5 [OK]
docker.io docker.io/alterway/mysql Docker Mysql 3 [OK]
docker.io docker.io/bitnami/mysql Bitnami MySQL Docker Image 3 [OK]
docker.io docker.io/frodenas/mysql A Docker Image for MySQL 3 [OK]
docker.io docker.io/drupaldocker/mysql MySQL for Drupal 2 [OK]
docker.io docker.io/yfix/mysql Yfix docker built mysql 2 [OK]
docker.io docker.io/coscale/mysql CoScale custom configuration of the offici... 1 [OK]
docker.io docker.io/debezium/example-mysql Example MySQL database server with a simpl... 1 [OK]
docker.io docker.io/lysender/mysql MySQL base image using Ubuntu 16.04 Xenial 1 [OK]
docker.io docker.io/newrelic/mysql-plugin New Relic Plugin for monitoring MySQL data... 1 [OK]
docker.io docker.io/tozd/mysql MySQL (MariaDB fork) Docker image. 1 [OK]
docker.io docker.io/xalt/mysql Mysql with special Atlassian configuration... 1 [OK]
docker.io docker.io/1maa/mysql MySQL database 0 [OK]
docker.io docker.io/captomd/mysql CaptoMD mysql configuration 0 [OK]
docker.io docker.io/cloudposse/mysql Improved `mysql` service with support for ... 0 [OK]
docker.io docker.io/datajoint/mysql MySQL image pre-configured to work smoothl... 0 [OK]
docker.io docker.io/nanobox/mysql MySQL service for nanobox.io 0 [OK]
docker.io docker.io/projectomakase/mysql Docker image for MySQL 0 [OK]

//配置国内daocloud提供的docker hub 加速
[root@localhost ~]# curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://67c8ec85.m.daocloud.io
{"registry-mirrors": ["http://67c8ec85.m.daocloud.io"],
"live-restore": true
}
Success.
You need to restart docker to take effect: sudo systemctl restart docker
//重启docker
[root@localhost ~]# sudo systemctl restart docker
//下载docker镜像
[root@localhost ~]# docker pull mysql
Using default tag: latest
Trying to pull repository docker.io/library/mysql ...
latest: Pulling from docker.io/library/mysql
5040bd298390: Pull complete
55370df68315: Pull complete
fad5195d69cc: Pull complete
a1034a5fbbfc: Pull complete
17f3570b42ae: Pull complete
6bf4b16e5339: Pull complete
9700c9731729: Pull complete
f2fea9c5b632: Pull complete
2f8101f5336d: Pull complete
0dc8f8a1031a: Pull complete
a1b9627588c7: Pull complete
Digest: sha256:84c80bb229e8cbcda748a05e99bc4c999df10d9ffd30e41e86e60e4fb13aa6da
//查询本地已有docker镜像
[root@localhost ~]# docker images mysql
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/mysql latest 7666f75adb6b 10 days ago 405.6 MB
//运行docker容器
[root@localhost ~]# docker run -i -t mysql /bin/bash
root@a198c035b3f7:/# ps
PID TTY TIME CMD
1 ? 00:00:00 bash
6 ? 00:00:00 ps
root@a198c035b3f7:/# ls
bin boot dev docker-entrypoint-initdb.d entrypoint.sh etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var


   

推荐阅读
author-avatar
cocoa_小米多本_148
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有