含源码 【保姆级教程】Docker基础操作篇-Dokerfile

系列文章:
你好!【概念+源码+保姆式教程】【保姆级教程】进阶操作篇-(含源码)常用命令【保姆级教程】+ 7 配置静态IP(小名已排雷,放心跟着教程走)
本文目录
第一步:安装
【含源码【保姆级教程】Docker基础操作篇-Dokerfile】1. 执行命令:
[root@eamon ~]# curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
2. 安装成功后,查看版本:
[root@eamon ~]# docker versionClient: Docker Engine - CommunityVersion:20.10.3API version:1.41Go version:go1.13.15Git commit:48d30b5Built:Fri Jan 29 14:34:14 2021OS/Arch:linux/amd64Context:defaultExperimental:trueCannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
3. 注册阿里云账号 → 选择“容器镜像服务”(免费)
4. 选择最后一个“镜像加速器”,按照下面的教程,完成4步配置的阿里云加速器
5. 启动
[root@eamon ~]# systemctl start docker
第二步:安装第一个Mysql镜像
1. 方法一:查看mysql在中有哪些镜像
[root@eamon ~]# docker search mysqlNAMEDESCRIPTIONSTARSOFFICIALAUTOMATEDmysqlMySQL is a widely used, open-source relation…10466[OK]mariadbMariaDB is a community-developed fork of MyS…3891[OK]mysql/mysql-serverOptimized MySQL Server Docker images. Create…768[OK]perconaPercona Server is a fork of the MySQL relati…526[OK]centos/mysql-57-centos7MySQL 5.7 SQL database server87mysql/mysql-clusterExperimental MySQL Cluster Docker images. Cr…79centurylink/mysqlImage containing mysql. Optimized to be link…59[OK]bitnami/mysqlBitnami MySQL Docker Image48[OK]deitch/mysql-backupREPLACED! Please use http://hub.docker.com/r…41[OK]databack/mysql-backupBack up mysql databases to... anywhere!37prom/mysqld-exporter37[OK]tutum/mysqlBase docker image to run a MySQL database se…35schickling/mysql-backup-s3Backup MySQL to S3 (supports periodic backup…29[OK]linuxserver/mysqlA Mysql container, brought to you by LinuxSe…27centos/mysql-56-centos7MySQL 5.6 SQL database server20circleci/mysqlMySQL is a widely used, open-source relation…20arey/mysql-clientRun a MySQL client from a docker container17[OK]mysql/mysql-routerMySQL Router provides transparent routing be…17fradelg/mysql-cron-backupMySQL/MariaDB database backup using cron tas…11[OK]openshift/mysql-55-centos7DEPRECATED: A Centos7 based MySQL v5.5 image…6devilbox/mysqlRetagged MySQL, MariaDB and PerconaDB offici…3ansibleplaybookbundle/mysql-apbAn APB which deploys RHSCL MySQL2[OK]widdpim/mysql-clientDockerized MySQL Client (5.7) including Curl…1[OK]jelastic/mysqlAn image of the MySQL database server mainta…1monasca/mysql-initA minimal decoupled init container for mysql0
方法二:在官网查看(需要注册账号,且外网速度比较慢):
官网
搜索MySql → 点击MySql
点击“Tags”查看都有哪些mysql镜像
2. 根据所需拉取相应的MySql版本(这里我使用的.7):
(1)拉取MySql镜像:
[root@eamon ~]# docker pull mysql:5.75.7: Pulling from library/mysqla076a628af6f: Pull complete f6c208f3f991: Pull complete 88a9455a9165: Pull complete 406c9b8427c6: Pull complete 7c88599c0b25: Pull complete 25b5c6debdaf: Pull complete 43a5816f1617: Pull complete 1831ac1245f4: Pull complete 37677b8c1f79: Downloading [======================>]48.79MB/108.4MB27e4ac3b0f6e: Download complete 7227baa8c445: Download complete
(2)待到MySql每一层镜像都呈Pull 即为拉取镜像完成
[root@eamon ~]# docker pull mysql:5.75.7: Pulling from library/mysqla076a628af6f: Pull complete f6c208f3f991: Pull complete 88a9455a9165: Pull complete 406c9b8427c6: Pull complete 7c88599c0b25: Pull complete 25b5c6debdaf: Pull complete 43a5816f1617: Pull complete 1831ac1245f4: Pull complete 37677b8c1f79: Pull complete 27e4ac3b0f6e: Pull complete 7227baa8c445: Pull complete Digest: sha256:b3d1eff023f698cd433695c9506171f0d08a8f92a0c8063c1a4d9db9a55808dfStatus: Downloaded newer image for mysql:5.7docker.io/library/mysql:5.7