【docker学习二】CentOS7.5+Docker 镜像(容器)的使用
承接上篇:https://mp.csdn.net/postedit/82744127
上文介绍了容器与镜像的基本操作,这里总结下容器的使用。
先在官网找到一个镜像:
https://hub.docker.com/r/centos/mysql-57-centos7/
[root@localhost mydc]# docker search centos
FROM ubuntu
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
centos The official build of CentOS. 4722 [OK]
ansible/centos7-ansible Ansible on Centos7 118 [OK]
jdeathe/centos-ssh CentOS-6 6.10 x86_64 / CentOS-7 7.5.1804 x86… 99 [OK]
consol/centos-xfce-vnc Centos container with "headless" VNC session… 63 [OK]
imagine10255/centos6-lnmp-php56 centos6-lnmp-php56 45 [OK]
tutum/centos Simple CentOS docker image with SSH access 43
centos/mysql-57-centos7 MySQL 5.7 SQL database server 39
gluster/gluster-centos Official GlusterFS Image [ CentOS-7 + Glust… 34 [OK]
openshift/base-centos7 A Centos7 derived base image for Source-To-I… 33
centos/python-35-centos7 Platform for building and running Python 3.5… 30
centos/postgresql-96-centos7 PostgreSQL is an advanced Object-Relational … 29
kinogmt/centos-ssh CentOS with SSH 22 [OK]
openshift/jenkins-2-centos7 A Centos7 based Jenkins v2.x image for use w… 15
pivotaldata/centos-gpdb-dev CentOS image for GPDB development. Tag names… 7
openshift/wildfly-101-centos7 A Centos7 based WildFly v10.1 image for use … 5
openshift/jenkins-1-centos7 DEPRECATED: A Centos7 based Jenkins v1.x ima… 4
darksheer/centos Base Centos Image -- Updated hourly 3 [OK]
pivotaldata/centos Base centos, freshened up a little with a Do… 2
pivotaldata/centos-mingw Using the mingw toolchain to cross-compile t… 2
blacklabelops/centos CentOS Base Image! Built and Updates Daily! 1 [OK]
pivotaldata/centos-gcc-toolchain CentOS with a toolchain, but unaffiliated wi… 0
pivotaldata/centos7-build CentosOS 7 image for GPDB compilation 0
smartentry/centos centos with smartentry 0 [OK]
jameseckersall/sonarr-centos Sonarr on CentOS 7 0 [OK]
pivotaldata/centos7-test CentosOS 7 image for GPDB testing 0
[root@localhost mydc]# docker pull centos/mysql-57-centos7
Using default tag: latest
latest: Pulling from centos/mysql-57-centos7
256b176beaff: Pull complete
efb19fea0fdb: Pull complete
b4570fdc208c: Pull complete
213e4e250552: Pull complete
455c976d8b6f: Pull complete
2d8a583c0d63: Pull complete
997ede30fc40: Pull complete
5cc4480f88a0: Pull complete
2e721eb8f5f6: Pull complete
Digest: sha256:c8a8323721c60a49b1792d31a7892731c741d58c238d77b42f0dcf8d7c32c1b4
Status: Downloaded newer image for centos/mysql-57-centos7:latest
[root@localhost mydc]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos/mysql-57-centos7 latest 34300611d53e 9 days ago 445MB
ubuntu latest cd6d8154f1e1 13 days ago 84.1MB
[root@localhost mydocker]# docker run -d --name mysql_database -e MYSQL_USER=root -e MYSQL_PASSWORD= -e MYSQL_DATABASE=db -p 3306:3306 centos/mysql-57-centos7
f443dd67716c2ffd0570caa35a3aa499c1d1fb65fcc6c6859fa315a51d48777b
查看本地镜像
[root@localhost admin]# docker image list
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu_mine latest d0ec321b73c6 7 days ago 84.1MB
centos/mysql-57-centos7 latest 34300611d53e 2 weeks ago 445MB
ubuntu latest cd6d8154f1e1 2 weeks ago 84.1MB
mysql/mysql-server latest 1fdf3806e715 6 weeks ago 309MB
查看本地容器有哪些
[root@localhost admin]# docker container list
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
27c2fb71f4e9 centos/mysql-57-centos7 "container-entrypoin…" 4 minutes ago Restarting (1) 23 seconds ago mysqlofmine
[root@localhost admin]#
根据镜像创建容器
docker container run
--name=mysqlofmine(container的名字)
--publish=3306:3306
--volume=/data/mysql/:/var/lib/mysql/
--restart=always
--env=MYSQL_ROOT_PASSWORD=123456
-d centos/mysql-57-centos7(image的名字)
【docker学习二】CentOS7.5+Docker 镜像(容器)的使用的更多相关文章
- <Docker学习>2.Centos7安装docker
Docker CE 支持 64 位版本 CentOS 7,并且要求内核版本不低于 3.10. CentOS 7 满足最低内核的要求,但由于内核版本比较低,部分功能(如 overlay2 存储层驱动)无 ...
- Docker学习笔记之--.Net Core应用容器通过网桥连接Redis容器(环境:centos7)
上节演示通过应用容器连接sql server容器,连接:Docker学习笔记之--.Net Core项目容器连接mssql容器(环境:centos7) 本节演示安装 redis容器,通过网桥连接 先决 ...
- Docker学习之Centos7下安装
Docker学习之Centos7下安装 centos7 64下直接使用yum安装docker环境,步骤如下: 卸载旧版本docker sudo yum remove docker docker-com ...
- Docker学习(十)Docker容器编排 Docker-compose
Docker学习(十)Docker容器编排 Docker-compose 标签(空格分隔): docker 容器编排是什么 应用一般由单独容器化的组件组成,须按照一定顺序在网络级别进行组织,以使其能够 ...
- [转]Docker学习之四:使用docker安装mysql
本文转自:https://blog.csdn.net/qq_19348391/article/details/82998391 Docker学习之一:注册Docker Hub账号 Docker学习之二 ...
- Docker学习(十一)Docker系列结束-新的开始K8S
Docker学习(十一)Docker系列结束-新的开始K8S 标签(空格分隔): docke k8s Docker系列结束 上一篇讲到使用docker官方提供的容器编排工具docker-compose ...
- Docker学习笔记之--.Net Core项目容器连接mssql容器(环境:centos7)
前一节演示在docker中安装mssql,地址:Docker学习笔记之--安装mssql(Sql Server)并使用Navicat连接测试(环境:centos7) 本节演示 .Net Core项目容 ...
- Docker学习笔记-CentOS7镜像
前言: 环境:centos7.5 64 位 正文: 第一步:下载centos7镜像 docker pull centos 第二步:建立centos7的容器 sudo docker run --priv ...
- docker 学习之路 将docker容器变为镜像并上传
环境 ubunt 16.4 去hub.docker.com上注册一个账号,并在账号中注册一个公有public或者私有仓库private 步骤如下 如上图 点击该处进入创建docker库页面 除了名字之 ...
- docker学习-lnmp+redis之搭建lnp容器服务
nginx+php7.0容器服务 本来想用单独的容器(nginx和php分开),但是因为是初学,php容器安装扩展的时候一直失败,所以就把centos+nginx+php放一起搭建了,优点是扩展简单, ...
随机推荐
- hann function
hann function 是一种离散型窗函数,定义如下: w(n)=12(1−cos(2πnN−1))=sin2(πnN−1) 窗口的长度为 L=N+1; hann function 以及其傅里叶响 ...
- Program for Linux USB-devices driver step by step (ONE)
Program for Linux USB-devices driver 開始啃硬骨头~ 这里我打算一步步给出USB device driver 的demo.希望有心能可以共同交流学习. 希望认识很多 ...
- 【转】CefSharp 与 js 相互调用
转自CSDN博客博主ghui,虽然博主说要经过他同意才能转,我只是做笔记用,没做他用,所以请博主理解,在此感谢博主! 一. CefSharp调用 js CefSharp.WinForms.Chromi ...
- HDU-3839-Ancient Messages(DFS)
Problem Description In order to understand early civilizations, archaeologists often study texts wri ...
- nuget包发布
创建项目 需要选择.net Standard的项目 0 设置包信息 1 打包 2 在bin目录下可以看到生成的.nupkg文件 3 发布包 登录https://www.nuget.or ...
- zendframework 初始化配置
https://framework.zend.com/manual/2.4/en/tutorials/config.advanced.html#environment-specific-system- ...
- html 自制属性
HTML5 允许扩展的(自制的)属性,以 data- 开头 <label id="id0" data-value="0">0</label&g ...
- 【转】Powerdesigner逆向工程从sql server数据库生成pdm
第一步:打开"控制面板"中的"管理工具" 第二步:点击"管理工具"然后双击"数据源(odbc)" 第三步:打开之后,点击 ...
- C#连接oracle 数据库查询时输入中文查询不出来,用plsql就可以
查询语句为:select * from Per where khmc like '%李%',其实是字符集的问题. 解决方案:在连接字符串加一个“Unicode=True;”
- iostat命令浅析
报告中央处理器(CPU)统计信息.整个系统.适配器.TTY 设备.磁盘 CD-ROM.磁带和文件系统的异步输入/输出(AIO)与输入/输出统计信息,iostat也有一个弱点,就是它不能对某个进程进行深 ...