docker


Docker on Windows 10 startup: database tables and bound directories are disappearing


I'm using Docker with Win 10. When Docker starts up, it creates containers with MySQL automatically which is great. The problem is that the database tables and bound directories are disappearing. To make them appear again I have to change to the directory of each project and recreate the conatiner manually. I have to do this every time my Computer is restarted which is cumbersome:
$ cd env-projX
$ docker-compose down
$ docker-compose up -d
Any ideas how to solve that?
My docker-compose.yml
version: '2'
services:
mysql:
image: mysql:5.7
restart: always
ports:
- "${HOST_IP}:${MYSQL_PORT}:3306"
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
volumes:
- "./docker/mysql/dump:/home/dumps"
- "./docker/mysql/data:/var/lib/mysql"
Update:
A workaround for disappearing database table is when I don't share the database files with the host any more, say:
- "db-data:/var/lib/mysql"
instead of
- "./docker/mysql/data:/var/lib/mysql"
so my configuration looks now like this:
version: '2'
services:
mysql:
image: mysql:5.7
restart: always
ports:
- "${HOST_IP}:${MYSQL_PORT}:3306"
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
volumes:
- "./docker/mysql/dump:/home/dumps"
- "db-data:/var/lib/mysql"
volumes:
db-data:

Related Links

How to prevent “docker-machine create” to install/upgrade docker host, just add it
docker-compose not working
Docker Compose Continuous Deployment setup
Expose urls for Docker compose
How to get the container Id of the running container using docker-java?
Docker exit code 125 and 'Device is Busy' error
Unable to create a thinpool in Debian
How to run docker image produced by VS 2017
Spring Boot in Docker
Copy a folder into a mounted volume within a Docker Container
Run image in docker
cron task in docker container not being executed
Use Container Metrics from Prometheus
Docker precheck error “code E_FAIL(0x80004005)”
Is it possible to change the read-only/read-write status of a docker mount at runtime?
Unable to start any container when Volumes are enabled Docker Toolbox

Categories

HOME
node.js
web
perl
qt5
google-analytics
reverse-geocoding
alexa
firmware
asp-classic
informix
bitcoin
winzip
freeswitch
metal
mips32
raspberry-pi3
ejb
sage
autofixture
codeception
bayesian
shoutem
sql-azure
odbc
sqlanywhere
multiline
raycasting
mysql-error-1064
react-apollo
gnome
remote-connections
kafka-python
choropleth
c#-to-f#
vim-syntax-highlighting
kinvey
sublimerepl
get-eventlog
angular-daterangepicker
psftp
pi
interactive
sphero-api
3d-modelling
marytts
oclazyload
android-device-monitor
xunit.net
exceljs
case-sensitive
heyzap
fuzzy
same-origin-policy
prime-factoring
xml-rpc
maven-resources-plugin
use-case
rpy2
nslog
ms-project-server-2013
syncsort-dmx-h
mapfragment
dotpeek
test-and-target
anonymity
httpful
angular-component-router
dsquery
datamapper
8085
stompjs
wx
objdump
acl2
xlet
proto
safari9
eazfuscator
determinants
voog
pig-udf
lightroom
allocation
mysql-num-rows
searchqueryset
jaggery-js
linux-capabilities
string-search
unassigned-variable
facade
mux
javascript-databinding
syntactic-sugar
kooboo
start-stop-daemon
policies
application-integration
styledtext
dbase
postfix-operator
rs485
kendo-tooltip
jvm-crash
mathtype
array-formulas
mysql-5.0
pmp
trusted-timestamp
emacs-dirtree
strtotime
appmobi
objectiveflickr
phonetics
getprocaddress
ext-direct
cloning
tao
incremental-linking
maintaining-code

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App