Wie sende ich mit Docker ein Passwort an MySQL?
Sep 01 2020
Ich möchte gerade erst die heruntergeladene Version von mysql:
root:~#
root:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
basex/basexhttp latest 3339bf6bc898 4 days ago 226MB
twilio/twilio-java latest 611ab7ece1cf 12 days ago 993MB
mysql latest 0d64f46acfd1 3 weeks ago 544MB
jetty latest 5f997007f18d 4 weeks ago 522MB
hello-world latest bf756fb1ae65 8 months ago 13.3kB
root:~#
root:~# docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
root:~#
root:~# docker run mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password
2020-09-01 06:53:03+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.21-1debian10 started.
2020-09-01 06:53:03+00:00 [ERROR] [Entrypoint]: mysqld failed while attempting to check config
command was: mysqld -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password --verbose --help
Enter password: mysqld: Can not perform keyring migration : Invalid --keyring-migration-source option.
2020-09-01T06:53:03.366882Z 0 [ERROR] [MY-011084] [Server] Keyring migration failed.
2020-09-01T06:53:03.368621Z 0 [ERROR] [MY-010119] [Server] Aborting
root:~#
Ohne das Bild erneut herunterzuladen .
Antworten
2 KonradBotor Sep 02 2020 at 03:17
Wie in der Dokumentation eindeutig angegeben, docker runsollte der Befehl wie folgt aufgerufen werden:
docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]
also wenn du rennst
docker run mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password
Docker geht davon aus, dass -p 3306:3306 -e MYSQL_ROOT_PASSWORD=passwordes sich um einen Befehl handelt, den Sie im Container ausführen möchten, und nicht um eine Liste von Befehlsoptionen docker run.
Der richtige docker runAufruf mit den von Ihnen angegebenen Parametern lautet:
docker run -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password mysql
NicholasSaunders Sep 01 2020 at 14:03
docker run -e MYSQL_ROOT_PASSWORD=pass --name sql-db -p 3306:3306 mysql
Ups, irgendwie habe ich es nicht gesehen .