Currently learning the Docker basics and I'm having trouble when running a MYSQL image that has a Volume configured.
I'm running an up to date version of Docker Desktop for Mac on macOS 10.14.3.
When running this is works fine:
docker run -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root mysql:8.0
But when adding a -v option it connects and then exits immediately.
docker run -d -v /Users/joebloggs/path/to/my/data:/var/lib/mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root mysql:8.0
I've tried all major versions of the official mysql image.
Here's part of a docker inspect dump:
"State": {
"Status": "exited",
"Running": false,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 0,
"ExitCode": 1,
"Error": "",
"StartedAt": "2019-03-26T13:41:29.106885548Z",
"FinishedAt": "2019-03-26T13:41:31.48468934Z"
},
And the Mounts section:
"Mounts": [
{
"Type": "bind",
"Source": "/Users/joebloggs/path/to/my/data",
"Destination": "/var/lib/mysql",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
}
],
Though according to your command, the misplaced parameters could be the cause; Use this:
$ docker run -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root mysql:8.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With