docker@win10でmysqlとphpmyadinを立ち上げる
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# docker hubを検索 docker search mysql # ローカルにダウンロード docker pull mysql # とりあえず実行してみる。 docker run mysql # rootのパスワードを設定しろ!と怒られる docker run -e MYSQL_ROOT_PASSWORD=root mysql # なんか起動したっぽい docker container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 7234b7aefa95 mysql "docker-entrypoint.s…" About a minute ago Up About a minute 3306/tcp, 33060/tcp brave_lamarr 3703cc876281 httpd "httpd-foreground" 44 minutes ago Up 44 minutes 0.0.0.0:8080->80/tcp, :::8080->80/tcp myContainer # ssh的な感じで接続 # -i --interactive(コマンド入力) # -t --tty(ターミナル出力) docker exec -i -t 7234b7aefa95 bin/bash root@7234b7aefa95:/# pwd / root@7234b7aefa95:/# ls bin boot dev docker-entrypoint-initdb.d entrypoint.sh etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var # mysqlへrootでログイン root@7234b7aefa95:/# mysql --version mysql Ver 8.0.25 for Linux on x86_64 (MySQL Community Server - GPL) root@7234b7aefa95:/# mysql -u root -proot |
phpmyadminでmysqlを操作したい。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# あるっぽい docker search phpmyadmin # ローカルにダウンロード docker pull phpmyadmin # とりあえず実行してみる。apacheのServerNameが設定されてないよ!と怒られる docker run phpmyadmin AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.4. Set the 'ServerName' directive globally to suppress this message AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.4. Set the 'ServerName' directive globally to suppress this message [Mon Jun 21 05:55:48.405141 2021] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.4.20 configured -- resuming normal operations [Mon Jun 21 05:55:48.405194 2021] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND' # 起動しているっぽい docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 394b44b64d29 phpmyadmin "/docker-entrypoint.…" 24 seconds ago Up 21 seconds 80/tcp cranky_margulis d731bbefa9cb mysql "docker-entrypoint.s…" 2 hours ago Up 2 hours 3306/tcp, 33060/tcp lucid_jang 3703cc876281 httpd "httpd-foreground" 3 hours ago Up 3 hours 0.0.0.0:8080->80/tcp, :::8080->80/tcp myContainer # docker container run --name myphpmyadmin -d -p 8081:80 phpmyadmin |
http://localhost:8081/ でログイン画面まで行けたけど、エラーになった。
mysqli::real_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known
mysqli::real_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known