-1

I used command "docker pull mysql:5.7.28" which showed image and container correctly in docker desktop but when trying to run the container it showed exited and error was MYSQL_ROOT_PASSWORD required.

So I need to edit MYSQL_ROOT_PASSWORD in yaml file to resolve this issue. Now the problem is simple I have not used docker-compose file to setup the container and unable to find option in docker desktop to set up this variable.

Yogesh.galav
  • 225
  • 1
  • 5
  • 17
  • 1
    I'm not really sure what you're asking. You _create_ a docker-compose.yml file to set up your containers. – ndc85430 Jun 14 '22 at 03:15
  • 1
    I used command "docker pull mysql:5.7.28" which showed image and container correctly in docker desktop but when trying to run the container it showed exited and error was MYSQL_ROOT_PASSWORD required. – Yogesh.galav Jun 14 '22 at 04:41
  • FYI, I posted a quite similar Question on sister site, SuperUser Stack Exchange. See: [*How to add an environment variable to a container in Docker Desktop?*](https://superuser.com/q/1803976/212610) – Basil Bourque Aug 14 '23 at 00:37

1 Answers1

1

You can set the environment variable when you run the container with docker run - see, e.g. "Start a mysql server instance" on https://hub.docker.com/_/mysql.

An alternative would be to create a docker-compose.yml and set the environment variable there (the reference for what you can put in Compose files is here).

There might be a way to set environment variables in Docker Desktop, but I don't use it, so I don't know. The documentation should tell you, though.

ndc85430
  • 1,395
  • 3
  • 11
  • 17