Saya sudah mencoba solusinya di utas stackoverflow ini. Itu tidak berhasil untuk saya, seperti yang ditunjukkan di bawah ini.
Ini file docker-compose.yml
saya:
version: "3.7"
services:
db:
image: mysql
volumes:
- data:/var/lib/mysql
volumes:
data:
driver_opts:
type: none
device: /usr/local/opt/mysql/mywebsite.com
o: bind
Berikut hasil docker-compose up
:
$ docker-compose up
Creating volume "mycontainer_data" with default driver
Recreating 45bc03b2c674_mycontainer_db_1 ... error
ERROR: for 45bc03b2c674_mycontainer_db_1 Cannot create container for service db: error while mounting volume with options: type='none' device='/usr/local/opt/mysql/mywebsite.com' o='bind': no such file or directory
ERROR: for db Cannot create container for service db: error while mounting volume with options: type='none' device='/usr/local/opt/mysql/mywebsite.com' o='bind': no such file or directory
ERROR: Encountered errors while bringing up the project.
Daripada type: none
, saya juga mencoba type: volume
dan type: bind
, tetapi saya mendapatkan kesalahan yang sama.
Direktorinya jelas ada:
$ ls -al /usr/local/opt/mysql/
...
drwxr-xr-x 2 cameronhudson staff 64 Jun 10 10:32 mywebsite.com
...