20

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.

VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755
Richard Løvehjerte
  • 584
  • 1
  • 4
  • 12

1 Answers1

30

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]
user2915097
  • 27,609
  • 6
  • 52
  • 56
VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755