docker搭建mysql

下载mysql镜像

[root@localhost ~]# docker pull mysql:5.5.59

创建mysql容器

[root@localhost ~]# docker run -itd --name mysql -p 3309:3306 --restart=always -e MYSQL_ROOT_PASSWORD=123456 mysql:5.5.59
-i,-interactive          Keep STDIN open even if not attached
-t,--tty                 Allocate a pseudo-TTY
-d, --detach             Run container in background and print container ID
--name string            Assign a name to the container 
-p,--publish list        Publish a container's port(s) to the host
--restart string         Restart policy to apply when a container exits (default "no")
-e ,--env list           Set environment variables
原文地址:https://www.cnblogs.com/yyxianren/p/10722866.html