Hallo. I am using the the official MySQL Docker image (command: docker pull mysql), which requires me to set the environment variables like "password" through the container configuration. I was wondering is there a way to set up the password in the function of create_project?
project = client.create_project(
repository=repository,
devcontainer=ImageDevContainer(
image=mysql,
),
)
Here is the code by using the package of docker to set up the password in the environment argument (environment={
"MYSQL_ROOT_PASSWORD": "password",},). See below.
import docker
client = docker.from_env()
container: containers.Container = client.containers.run(
image='mysql',
name=f"mysql_{port}",
environment={
"MYSQL_ROOT_PASSWORD": "password",
},
ports={"3306":port},
detach=True,
tty=True,
stdin_open=True,
remove=True,
)
Thank you for your help!!!!