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,262,500
  • 529
  • 4,410
  • 5,250
Richard Løvehjerte
  • 584
  • 1
  • 4
  • 12

1 Answers1

31

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
  • 30,758
  • 6
  • 57
  • 59
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250