Docker < v1.9
MySQL Container:
docker run -d \
-p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=secret \
-e MYSQL_DATABASE=bookstack \
-e MYSQL_USER=bookstack \
-e MYSQL_PASSWORD=secret \
--name bookstack_db \
mysql:5.7.21
BookStack Container:
docker run -d --link bookstack_db_:mysql \
-p 8080:8080 \
--name bookstack_22.04 \
solidnerd/bookstack:22.04
Docker 1.9+
Create a shared network:
docker network create bookstack_nw
Run MySQL container :
docker run -d --net bookstack_nw \
-e MYSQL_ROOT_PASSWORD=secret \
-e MYSQL_DATABASE=bookstack \
-e MYSQL_USER=bookstack \
-e MYSQL_PASSWORD=secret \
--name="bookstack_db" \
mysql:5.7.21
Run BookStack Container
docker run -d --net bookstack_nw \
-e DB_HOST=bookstack_db:3306 \
-e DB_DATABASE=bookstack \
-e DB_USERNAME=bookstack \
-e DB_PASSWORD=secret \
-e APP_URL=http://example.com \
-p 8080:8080 \
--name="bookstack_22.04" \
solidnerd/bookstack:22.04