First, create .env and run docker-compose.
SQL_HOST=db
SQL_PORT=3306
SQL_USER=root
SQL_PASSWORD=jh
SQL_DATABASE=DB_SQLSTK
docker-compose --env-file ./.env up
Second, set up the environment within docker-compose.yml.
version: '3.1'
services:
db:
image: mysql
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_ROOT_PASSWORD: jh
MYSQL_DATABASE: DB_SQLSTK
volumes:
- ./DB_SQLSTK_FULL_FOR_BOOK_20210521.sql:/docker-entrypoint-initdb.d/schema.sql:ro
ports:
- 3306:3306
networks:
- sql
jupyter:
build:
context: .
ports:
- 8888:8888
volumes:
- ./result:/usr/app/result
- ./src:/usr/app/src
networks:
- sql
################################
environment:
- SQL_HOST=db
- SQL_PORT=3306
- SQL_USER=root
- SQL_PASSWORD=jh
- SQL_DATABASE=DB_SQLSTK
################################
adminer: ## Web app that connects to sql database
image: adminer
ports:
- 8080:8080
networks:
- sql
networks:
sql:
'Docker' 카테고리의 다른 글
docker run -p 9000:8000 (0) | 2023.04.14 |
---|---|
The way how to find remote jupyter server(after connect two different containers) (0) | 2022.01.28 |
Docker error:port is already allocated (0) | 2022.01.28 |
Docker error:You have to remove (or rename) that container to be able to reuse that name. (0) | 2021.11.23 |
Docker Project 3-DockerCompose, Elasticsearch (0) | 2021.11.16 |