Docker: fix connectivity issues on Mac & Windows (#1275)

This commit is contained in:
Francesco Borzì
2019-01-13 15:32:57 +01:00
committed by GitHub
parent 93bccb9b85
commit 3b281e27ce
6 changed files with 53 additions and 29 deletions

View File

@@ -39,20 +39,27 @@ You can build the image using:
Run the following command to launch a container:
`docker run --name azt-db -p 127.0.0.1:3306:3306 -e MYSQL_ROOT_PASSWORD=password azerothcore/database`
```docker run --name ac-db-container \
-p 127.0.0.1:3306:3306 \
-e MYSQL_ROOT_PASSWORD=password \
--network ac-network \
azerothcore/database
```
Where:
`--name` is followed by a container name like `azt-db`. Put whatever name you like, each container should have an unique name.
`--name` is followed by a container name like `ac-db-container`. Put whatever name you like, each container should have an unique name.
`-p` (port) is followed by `IP_ADDRESS:EXTERNAL_PORT:INTERNAL_PORT`.
- INTERNAL_PORT **must** always be 3306.
- EXTERNAL_PORT is the port that you will use to access the mysql-server that is running in your container
- EXTERNAL_PORT is the port that you will use to access the mysql-server from outside docker
`--network` takes the name of the internal docker network. Containers must be on the same network to communicate to each other.
**NOTE**: You may want to use an external port different than 3306 in case you have already mysql-server installed in your system (or some other service that is using that port). So you can use for example port 9000 with `-p 127.0.0.1:9000:3306`
`docker run --name azt-db -p 9000:3306 -e MYSQL_ROOT_PASSWORD=password azerothcore/database`
`docker run --name ac-db-container -p 9000:3306 -e MYSQL_ROOT_PASSWORD=password azerothcore/database`
`-e MYSQL_ROOT_PASSWORD=password` lets you change the default password for the `root` user.
@@ -74,9 +81,9 @@ You can easily run more instances. You just have to specify a different **name**
Example: I want to launch three instances of the AzerothCore databases, each one listening respectively on port 9001, 9002 and 9003. I can do it with the following commands:
`docker run --name azt-db-1 -p 127.0.0.1:9001:3306 -e MYSQL_ROOT_PASSWORD=password -d azerothcore/database`
`docker run --name azt-db-2 -p 127.0.0.1:9002:3306 -e MYSQL_ROOT_PASSWORD=password -d azerothcore/database`
`docker run --name azt-db-3 -p 127.0.0.1:9003:3306 -e MYSQL_ROOT_PASSWORD=password -d azerothcore/database`
`docker run --name ac-db-container-1 -p 127.0.0.1:9001:3306 -e MYSQL_ROOT_PASSWORD=password -d azerothcore/database`
`docker run --name ac-db-container-2 -p 127.0.0.1:9002:3306 -e MYSQL_ROOT_PASSWORD=password -d azerothcore/database`
`docker run --name ac-db-container-3 -p 127.0.0.1:9003:3306 -e MYSQL_ROOT_PASSWORD=password -d azerothcore/database`
You can use the `docker ps` command to check your running containers.
@@ -84,6 +91,6 @@ You can use the `docker ps` command to check your running containers.
## Stopping / removing
You can stop a container using `docker stop name-of-the container`, for example `docker stop azt-db-1`.
You can stop a container using `docker stop name-of-the container`, for example `docker stop ac-db-container-1`.
You can then remove the container using `docker rm name-of-the container`, for example `docker rm azt-db-1`.
You can then remove the container using `docker rm name-of-the container`, for example `docker rm ac-db-container-1`.