centos安装Docker

yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
yum makecache fast && yum -y install docker-ce
systemctl start docker  && systemctl status docker && docker version

# 注意:
# 官方软件源默认启用了最新的软件,您可以通过编辑软件源的方式获取各个版本的软件包。例如官方并没有将测试版本的软件源置为可用,您可以通过以下方式开启。同理可以开启各种测试版本等。
# vim /etc/yum.repos.d/docker-ce.repo
#   将[docker-ce-test]下方的enabled=0修改为enabled=1
#
# 安装指定版本的Docker-CE:  
# Step 1: 查找Docker-CE的版本:
#    yum list docker-ce.x86_64 --showduplicates | sort -r
# Step2: 安装指定版本的Docker-CE: (VERSION例如上面的17.03.0.ce.1-1.el7.centos)
#    yum -y install docker-ce-[VERSION]
# 基本命令
## 查看镜像
docker images -a
docker rmi -f `docker images -qa`

## 查看镜像
docker ps -a
docker rm -f `docker ps -qa`
docker rm -f 4b63b973ce85

## 启动关闭docker
systemctl stop nginx && systemctl status nginx
systemctl start nginx && systemctl status nginx
systemctl restart docker && systemctl status nginx

centos镜像

centos镜像 并在centos容器中实现lnmp环境

#产生容器实例
## 创建centos
docker run -dit -p 80:80 -p 3306:3306 -v /usr/share/nginx/html/:/usr/share/nginx/html/  --privileged=true  --name mycentos 7547567567/mycentos:0001 /bin/bash 
docker run -dit -p 80:80 -p 3306:3306 -v /usr/share/nginx/html/:/usr/share/nginx/html/  --privileged=true  --name mycentos eeb6ee3f44bd /bin/bash

docker commit -a "zjk" -m "mylnmp" 2acad63af8e3 mylnmp:0001

# 进入容器
docker start mycentos 
docker exec -it mycentos /bin/bash

#安装源,更新系统,更新源
yum install epel-release -y
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
yum install yum-utils -y
yum update -y && yum install -y net-tools vim wget && yum clean all && yum makecache

# 安装mysql 请看另外一个文章
# 安装git,请看另外一个文章

# 安装nginx  php 
yum install  -y nginx php72-php-fpm 

# 卸载nginx  php
yum remove  -y  nginx php72-php-fpm 

yum list | grep 'php72-'
yum list | grep 'mysql'

systemctl status nginx
systemctl status php72-php-fpm

# 安装mysql 请看另外一个文章
systemctl status mysqld

systemctl stop nginx php72-php-fpm mysqld && systemctl start nginx php72-php-fpm mysqld

systemctl enable nginx php72-php-fpm mysqld

分开安装环境

php镜像
docker run --name  myphp7 -v /usr/share/nginx/html:/www  -d php:7.2.30-fpm
nginx镜像
docker run --name php-nginx -p 80:80 -v /usr/share/nginx/html:/usr/share/nginx/html -v /root/nginx/logs:/usr/share/nginx/logs  -v /root/nginx/conf:/etc/nginx/conf.d --link myphp7:php -d nginx

mysql镜像

docker pull nginx:1.20.2

results matching ""

    No results matching ""