docker 真是个安装软件的小天才
本地安装软件麻烦?! 找docker吧
docker安装软件又快又不出错
平平无奇的docker软件安装步骤
1 找到你要安装的软件的镜像名
可以到官网上找
2 拉取镜像 其实可以直接进行下一步 除非你要指定版本号 否则直接运行 就会帮你找到最新版下载
3 运行镜像
一般是
docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
这里是
官方运行MySQL服务实例
一般我们需要指定端口
可以加上 -p 第一个端口是外部访问的端口 程序中使用的就是该端口
第二个是容器内部的端口
-p 13306:3306
安装完成之后 验证吧
创建一个数据库
实验过程
C:\WINDOWS\system32>docker run --name container-mysql -e MYSQL_ROOT_PASSWORD=82576 -p 13306:3306
"docker run" requires at least 1 argument.
See 'docker run --help'.
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
Run a command in a new container
C:\WINDOWS\system32>docker run --name container-mysql -e MYSQL_ROOT_PASSWORD=82576 -p 13306:3306 mysql
Unable to find image 'mysql:latest' locally
latest: Pulling from library/mysql
b4d181a07f80: Already exists
a462b60610f5: Pull complete
578fafb77ab8: Pull complete
524046006037: Pull complete
d0cbe54c8855: Pull complete
aa18e05cc46d: Pull complete
32ca814c833f: Pull complete
9ecc8abdb7f5: Pull complete
ad042b682e0f: Pull complete
71d327c6bb78: Pull complete
165d1d10a3fa: Pull complete
2f40c47d0626: Pull complete
Digest: sha256:52b8406e4c32b8cf0557f1b74517e14c5393aff5cf0384eff62d9e81f4985d4b
Status: Downloaded newer image for mysql:latest
2021-07-10 14:12:30+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.25-1debian10 started.
2021-07-10 14:12:31+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2021-07-10 14:12:31+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.25-1debian10 started.
2021-07-10 14:12:31+00:00 [Note] [Entrypoint]: Initializing database files
2021-07-10T14:12:31.160314Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.25) initializing of server in progress as process 43
2021-07-10T14:12:31.166101Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-07-10T14:12:31.584909Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-07-10T14:12:32.634725Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2021-07-10 14:12:35+00:00 [Note] [Entrypoint]: Database files initialized
2021-07-10 14:12:35+00:00 [Note] [Entrypoint]: Starting temporary server
2021-07-10T14:12:36.194462Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.25) starting as process 88
2021-07-10T14:12:36.209649Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-07-10T14:12:36.356266Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-07-10T14:12:36.462067Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
2021-07-10T14:12:36.602434Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-07-10T14:12:36.602617Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-07-10T14:12:36.605065Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2021-07-10T14:12:36.620388Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.25' socket: '/var/run/mysqld/mysqld.sock' port: 0 MySQL Community Server - GPL.
2021-07-10 14:12:36+00:00 [Note] [Entrypoint]: Temporary server started.
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
2021-07-10 14:12:38+00:00 [Note] [Entrypoint]: Stopping temporary server
2021-07-10T14:12:38.979310Z 10 [System] [MY-013172] [Server] Received SHUTDOWN from user root. Shutting down mysqld (Version: 8.0.25).
2021-07-10T14:12:40.241023Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.25) MySQL Community Server - GPL.
2021-07-10 14:12:40+00:00 [Note] [Entrypoint]: Temporary server stopped
2021-07-10 14:12:40+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.
2021-07-10T14:12:41.201122Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.25) starting as process 1
2021-07-10T14:12:41.217178Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-07-10T14:12:41.362068Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-07-10T14:12:41.474493Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2021-07-10T14:12:41.591208Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-07-10T14:12:41.591397Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-07-10T14:12:41.594845Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2021-07-10T14:12:41.610792Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.25' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
网友评论