Vagrant + VirtualBox + CentOS7 + WindTerm 5分钟搭建本地linux开发环境
$ sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
$ sudo yum install -y yum-utils
$ sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
$ sudo mkdir -p /etc/docker
$ sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://ojy2ma14.mirror.aliyuncs.com"]
}
EOF
$ sudo yum install docker-ce docker-ce-cli containerd.io
// 启动docker
$ sudo systemctl start docker
// 开机启动
$ sudo systemctl enable docker
// 重启
$ sudo systemctl restart docker
[root@192 /]# docker search mysql
[root@192 /]# docker pull mysql
[root@192 /]# docker run -d --name mysql01 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=1234 --privileged mysql
[root@192 /]# docker ps
[root@192 /]# docker exec -it [container_id]/bin/bash
root@83b5df689930:/# mysql -uroot -p
mysql> show databases;
mysql> create database user_data;
mysql> use user_data;
mysql> show tables;
docker cp [sqlname].sql [container]:/tmp
mysql -u root -p < /tmp/[sqlname].sql
Tips:docker 常用指令
docker images
docker ps
docker ps -a
docker search [mysql/jdk/ngnix/...]
docker pull [image_name]
docker run --name [container_name] -p [ip]:[ip]
docker start [container_id]
docker stop [container_id]
docker rm -f [container_id]
docker rmi -f [image_id]