Mac M1에서 Docker mysql 5.7 설치

오픈소스·2023년 3월 6일
0
post-custom-banner
$ docker pull --platform liunx/amd64 mysql:5.7
5.7: Pulling from library/mysql
no matching manifest for liunx/amd64 in the manifest list entries

위 명령으로 안되고, 아래의 명령으로 다운로드가 되기는 하나,

$ docker run --rm --platform linux/amd64 -it mysql:5.7
Unable to find image 'mysql:5.7' locally
5.7: Pulling from library/mysql
e048d0a38742: Pull complete
c7847c8a41cb: Pull complete
351a550f260d: Pull complete
8ce196d9d34f: Pull complete
17febb6f2030: Pull complete
d4e426841fb4: Pull complete
fda41038b9f8: Pull complete
f47aac56b41b: Pull complete
a4a90c369737: Pull complete
97091252395b: Pull complete
84fac29d61e9: Pull complete
Digest: sha256:8cf035b14977b26f4a47d98e85949a7dd35e641f88fc24aa4b466b36beecf9d6
Status: Downloaded newer image for mysql:5.7
WARNING: image with reference mysql was found but does not match the specified platform: wanted linux/amd64, actual: linux/arm64/v8
2023-03-06 14:44:34+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.41-1.el7 started.
2023-03-06 14:44:35+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2023-03-06 14:44:35+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.41-1.el7 started.
2023-03-06 14:44:37+00:00 [ERROR] [Entrypoint]: Database is uninitialized and password option is not specified
    You need to specify one of the following as an environment variable:
    - MYSQL_ROOT_PASSWORD
    - MYSQL_ALLOW_EMPTY_PASSWORD
    - MYSQL_RANDOM_ROOT_PASSWORD
    
$ docekr images
REPOSITORY                                TAG       IMAGE ID       CREATED         SIZE
mysql                                     5.7       be16cf2d832a   4 weeks ago     455MB
$ docker run --platform linux/amd64 \
  -p 3306:3306 \
  --name mysql-container \
  -e MYSQL_ROOT_PASSWORD=1q2w3e4r \
  -e MYSQL_DATABASE=school \
  -v ${PWD}/mysql-data:/var/lib/mysql \
  -d mysql:5.7 \
  --character-set-server=utf8 \
  --collation-server=utf8_unicode_ci  
  
$ docker exec -it mysql-container bash
bash-4.2# mysql -h localhost -u root -p school
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.41 MySQL Community Server (GPL)

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

/etc/mysql/my.cnf 를 편집하기 위한 vi가 없다(apt-get도 없다).

https://umanking.github.io/2022/08/06/docker-mysql-m1/
--platform linux/amd64 mysql:8.0.28 mysql docker를 받으면, apt-get을 통해 vim을 설치할 수 있다.

$ apt-get update
$ apt-get install vim

참고)

post-custom-banner

0개의 댓글