【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放一起搭建了,优点是扩展简单, ...
随机推荐
- 解决用户绕过Servlet直接访问jsp页面
解决用户绕过ActionServlet,直接访问jsp文件的问题 1.将所有jsp文件拷贝到WEB-INF目录下 因为WEB-INF目录中的内容不能直接访问,但能转发过来 项目结构图如下: 2.修改s ...
- XamlReader 动态加载XAML
原文:XamlReader 动态加载XAML XAML: <Grid xmlns:x="http://schemas.microsoft.com/client/2006" x ...
- Some Very Good VC++/MFC Resources Besides Codeproject.com
Some Very Good VC++/MFC Resources Besides Codeproject.com http://www.naughter.com/ (VC++/MFC huge co ...
- Git配置用户名、邮箱、密码
配置用户名:username git config --global user.name username 配置邮箱:user@email git config --global user.email ...
- Angular 请求另一服务的api(请求代理)
1.edit "start" of your package.json to look below 定义一个叫做start的新命令 "start": " ...
- Android Camera2 拍照入门学习
原文:Android Camera2 拍照入门学习 学习资料: 肾虚将军android camera2 详解说明 极客学院android.hardware.camera2 使用指南 Android 5 ...
- JS如何为iframe添加onclick事件
如果页面上有iframe时,鼠标点击在iframe内时,包含iframe的document是不响应任何事件的, 例如: $("#iframe1").click(function() ...
- WPF中画蚂蚁线的实现
这是一个比较偏的功能,看了其他的很多博客都没有介绍,最后看自己试出来了. 先上效果图 <Path Data="M 100,240 C 510,300 80,100 300,160 H4 ...
- 用蓝牙连接debian和诺基亚手机
本方法已经用debian 4.0.诺基亚9300和一个hl-united牌子的USB蓝牙适配器测试过了,效果很好. 1.安装必要的软件包: #apt-get install ...
- 3D-Touch Home Screen Quick Actions 使用
1. 3D-Touch简单介绍 3D-Touch是iPhone 6s推出的一种可以让你与手机进行互动的全新方式.这一次,iPhone 能够感应你按压屏幕的力度.除了轻点.轻扫.双指开合这些熟悉的 Mu ...