Sure! Here's the converted Docker Compose YAML file with a MySQL server as a separate container and a Docker volume for storage:
version: '3'
services:
wandb-local:
image: wandb/local
container_name: wandb-local
environment:
- HOST=https://YOUR_DNS_NAME
- LICENSE=XXXXX
- BUCKET=s3://${ACCESS_KEY}:${SECRET_KEY}@${HOST}/${BUCKET_NAME}
- BUCKET_QUEUE=internal://
- AWS_REGION=us-east1
- MYSQL=mysql://${USERNAME}:${PASSWORD}@db/${DATABASE}
ports:
- 8080:8080
depends_on:
- db
restart: unless-stopped
db:
image: mysql:latest
container_name: wandb-mysql
environment:
- MYSQL_DATABASE=${DATABASE}
- MYSQL_USER=${USERNAME}
- MYSQL_PASSWORD=${PASSWORD}
- MYSQL_ROOT_PASSWORD=${ROOT_PASSWORD}
volumes:
- db_data:/var/lib/mysql
restart: unless-stopped
volumes:
db_data:In this Docker Compose file:
-
The
wandb-localservice is defined using thewandb/localimage. It includes the necessary environment variables, such asHOST,LICENSE,BUCKET,BUCKET_QUEUE,AWS_REGION, andMYSQL. TheMYSQLenvironment variable is updated to reference thedbservice for the MySQL connection. -
The
dbservice is added to run a MySQL server using themysql:latestimage. It includes environment variables for the database name, username, password, and root password. These values should be provided through environment variables or a separate.envfile. -
A named volume
db_datais defined to persist the MySQL data. It is mounted to the/var/lib/mysqldirectory in thedbcontainer. -
The
wandb-localservice depends on thedbservice, ensuring that the MySQL server starts before the Weights and Biases local instance. -
Both services are configured to restart unless stopped explicitly.
To use this Docker Compose file:
-
Save the content to a file named
docker-compose.yml. -
Create a
.envfile in the same directory and provide the necessary environment variable values, such asACCESS_KEY,SECRET_KEY,HOST,BUCKET_NAME,USERNAME,PASSWORD,DATABASE, andROOT_PASSWORD. -
Run the following command to start the containers:
docker-compose up -d
This will start the Weights and Biases local instance and the MySQL server as separate containers, with data persistence using a Docker volume.