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

Mixing cpu-shares and cpuset-cpus in Docker
Good strategy for storing data using Docker?
Use Prometheus “target relabeling” to extract cAdvisor's Docker image name without tag
Bluemix Docker container cf ic run doesn't seem to accept -p sub-command
Unable to push image to a docker registry configured as proxy cache
docker: connect to database container via dockerhost
Tsung: client connection using port
Detach Docker Container Automatically
docker-machine osx port forwarding
Image deployment with config files
Shared folder in Docker. With Windows. Not only “C/user/” path
Deploying docker swarm without using docker machine
Why does Yesod's TestImport module ignoreEnv in loadAppSettings?
Bind-mount volume of different type from guest to host
Responses from kubernetes containers getting lost
Docker plugin : java.io.FileNotFoundException: /src/main/docker/Dockerfile gradle-docker fails

Categories

HOME
videochat
rstudio
google-analytics
momentjs
cron
graphite
dfa
outlook-addin
uinavigationcontroller
spring-transactions
postgis
astyle
subplot
licode
.net-4.5
libcurl
pyside
xlwings
cdb
code-injection
jquery-animate
face-api
data-migration
angular-openlayers
radius
choropleth
hp-quality-center
javabeans
sharethis
database-theory
bootstrapping
webdrivermanager-java
outlook-web-app
audiokit
homescreen
fitnesse-slim
nerdtree
data-compression
sphero-api
scalacheck
interstitial
autocorrect
api-manager
orika
generated
knockout-validation
bisonc++
release-management
bubble-sort
libtool
rtai
twebbrowser
spock-reports
post-commit
webtorrent
ilmerge
openoffice-writer
cts
liquibase-hibernate
http-accept-header
irs
pdl
cirqus
jlist
unique-constraint
mpmediapickercontroller
safari9
kirby
zipcode
worksite-sdk
networkcredentials
linux-capabilities
aglio
nxt-python
resharper-plugins
stop-words
xcode6.1
dav
webproxy
psychology
intel-galileo
pyro
factoring
amazon-simpledb
panning
ejbql
shadowbox
function-overloading
continuations
snk
tunneling
bootclasspath
tao
www-mechanize
xml-comments
showmodaldialog
loose-coupling
duck-typing
projective-geometry
xla
pointer-arithmetic
nice
astoria

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