Notice
Recent Posts
Recent Comments
Link
«   2025/01   »
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
Archives
Today
Total
관리 메뉴

hellokiseok

Mysql Docker or Docker-compose 본문

Docker

Mysql Docker or Docker-compose

hellokiseok 2020. 5. 26. 20:04

Docker

# 간단 버전
docker run --name mysql -p 3306:3306 -d mysql

# 많이 쓰는 설정
docker run --name mysql -p 3306:3306 -e MYSQL_USER=admin -e MYSQL_ROOT_PASSWORD=secret -d mysql --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci

특정 버전 지정 :

docker run -p 3306:3306 mysql:8.0

("mysql:8.0" 해당 부분을 수정해주면 됩니다.)

버전 목록 : https://hub.docker.com/_/mysql?tab=tags

 

Docker-compose

docker-compose.yml

version: '3.1'

services:
  mysql:
    image: mysql
    volumes:
      - /my/own/datadir:/var/lib/mysql/data
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    environment:
      MYSQL_USER: admin
      MYSQL_ROOT_PASSWORD: example
    ports:
      - 3306:3306
docker-compose -f docker-compose.yml -p mysql up

 

 

 

 

참고 사이트 : https://hub.docker.com/_/mysql?tab=description

'Docker' 카테고리의 다른 글

Redis Docker or Docker-compose  (0) 2020.05.27
Next.js + Docker 설정하기  (0) 2020.05.26