assign static ip (#12727)
This commit is contained in:
parent
a7fc8039ff
commit
7f4e962fc7
@ -0,0 +1,27 @@
|
||||
services:
|
||||
db:
|
||||
container_name: mysql_db
|
||||
image: mysql:latest
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=password
|
||||
- MYSQL_ROOT_HOST=10.5.0.1
|
||||
ports:
|
||||
- '3306:3306'
|
||||
volumes:
|
||||
- db:/var/lib/mysql
|
||||
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
networks:
|
||||
network:
|
||||
ipv4_address: 10.5.0.5
|
||||
|
||||
volumes:
|
||||
db:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
network:
|
||||
driver: bridge
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 10.5.0.0/16
|
||||
gateway: 10.5.0.1
|
13
docker-modules/docker-compose/assign-static-ip/init.sql
Normal file
13
docker-modules/docker-compose/assign-static-ip/init.sql
Normal file
@ -0,0 +1,13 @@
|
||||
CREATE DATABASE IF NOT EXISTS test;
|
||||
CREATE USER 'db_user'@'10.5.0.1' IDENTIFIED BY 'password';
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'db_user'@'10.5.0.1' WITH GRANT OPTION;
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
use test;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS TEST_TABLE (id int, name varchar(255));
|
||||
|
||||
|
||||
INSERT INTO TEST_TABLE VALUES (1, 'TEST_1');
|
||||
INSERT INTO TEST_TABLE VALUES (2, 'TEST_2');
|
||||
INSERT INTO TEST_TABLE VALUES (3, 'TEST_3');
|
Loading…
x
Reference in New Issue
Block a user