简体   繁体   中英

Commandline arguments in docker-compose

The mysql image for docker allows configuration parameters when running the container.

$ docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci

How is this achievable with docker-compose?
I've tried doing -command but I couldn't get it to work.

Considering mysql image Dockerfile has a CMD set to mysqld , you would need to include it to your docker-compose.yml v2 command :

command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci

Or try:

command: [mysqld, --character-set-server=utf8mb4, --collation-server=utf8mb4_unicode_ci]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM