ubuntu 安装docker并使用docker安装mysql

ubuntu 安装docker并使用docker安装mysql

curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/intranet | sh

sudo apt-get install -y docker.io

systemctl start docker

systemctl enable docker

ps  -ef | grep docker

docker search mysql

docker pull mysql

docker images

cd /opt/

mkdir mysql_docker

cd mysql_docker/

echo $PWD

docker run --name mysqlserver -v $PWD/conf:/etc/mysql/conf.d -v $PWD/logs:/logs -v $PWD/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d -i -p 3306:3306 mysql:latest

cd /var/lib/docker/containers/

docker ps -a

docker exec -it mysqlserver bash

docker update mysqlserver  --restart=always

远程启动
  mysql -uroot -p

你可能感兴趣的:(Linux,ubuntu,docker,mysql)