Così ho iniziato a usare docker-compose in sviluppo per un po 'ora sulla mia macchina host Ubuntu 14.04 LTS con un provider VirtualBox locale (boot2docker al suo interno).Docker Machine + Docker Compose + Volumi su Ubuntu
Solo di recente ho deciso di provare finestra mobile-macchina (a causa della integrazione con PyCharm), ma io sono in esecuzione in alcuni problemi, come ad esempio quando salvo qualche nuovo codice del contenitore finestra mobile non viene più aggiornato automaticamente e credo che la sua perché ho commentato i miei volumi nel mio servizio web docker-compose.yml
ma se non avrò un errore manage.py not found
quindi ho capito in questo here che dovrei commentare invece.
Ho letto molte cose su Internet e vorrei sapere se c'è un buon e semplice approccio per far sì che la finestra mobile funzioni bene con docker-compose su Ubuntu.
DockerFile
FROM ubuntu:14.04.3
ENV PYTHONUNBUFFERED 1
RUN apt-get update && apt-get install -y \
build-essential \
git-core \
python2.7 \
python-pip \
python-dev \
libpq-dev \
postgresql-client-9.3 \
libjpeg-dev \
binutils \
libproj-dev \
gdal-bin
RUN mkdir /vagrant
WORKDIR /vagrant
RUN mkdir requirements
COPY requirements requirements
RUN pip install -r requirements/local.txt
COPY . /vagrant/
finestra mobile-compose.yml
postgis:
image: mdillon/postgis:9.3
ports:
- "5432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: "postgres"
# volumes:
# - /etc/postgresql
# - /var/log/postgresql
# - /var/lib/postgresql
web:
build: .
dockerfile: Dockerfile
command: python manage.py runserver 0.0.0.0:8000 --settings=xxx.settings.local
# https://stackoverflow.com/a/31567743/977622
# volumes:
# - .:/vagrant
ports:
- "8000:8000"
links:
- "postgis:postgis"
UPDATE:
quando ho eseguito il comando mount
dentro la mia vm ottengo:
tmpfs on/type tmpfs (rw,relatime,size=918096k)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,mode=600,ptmxmode=000)
tmpfs on /dev/shm type tmpfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/sda1 on /mnt/sda1 type ext4 (rw,relatime,data=ordered)
cgroup on /sys/fs/cgroup type tmpfs (rw,relatime,mode=755)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu type cgroup (rw,relatime,cpu)
cgroup on /sys/fs/cgroup/cpuacct type cgroup (rw,relatime,cpuacct)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,relatime,blkio)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,relatime,net_cls)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,relatime,perf_event)
cgroup on /sys/fs/cgroup/net_prio type cgroup (rw,relatime,net_prio)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,relatime,hugetlb)
/dev/sda1 on /mnt/sda1/var/lib/docker/aufs type ext4 (rw,relatime,data=ordered)
none on /mnt/sda1/var/lib/docker/aufs/mnt/137fb1ad9a432a3f4fa47667ecc9991c10149b71f02dfc06a8134fc348532a3d type aufs (rw,relatime,si=462e07a762a4065f,dio,dirperm1)
shm on /mnt/sda1/var/lib/docker/containers/137fb1ad9a432a3f4fa47667ecc9991c10149b71f02dfc06a8134fc348532a3d/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=65536k)
mqueue on /mnt/sda1/var/lib/docker/containers/137fb1ad9a432a3f4fa47667ecc9991c10149b71f02dfc06a8134fc348532a3d/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
nsfs on /var/run/docker/netns/2e4dbeed7a66 type nsfs (rw)
mio sh cartelle ARED dicono nell'interfaccia utente che il percorso della cartella è /home
Come il problema collegato spiega, i montaggi del volume dell'host sono relativi allo _host_ su cui è in esecuzione Docker. Se la macchina Docker è in esecuzione in un provider esternamente, il volume non saranno i dati dal computer locale. Dove è in esecuzione la macchina Docker? –
Sto eseguendo la finestra mobile in VirtualBox @AndyShinn – psychok7
È possibile accedere alla VM ('docker-machine ssh') e ottenere i supporti ('mount') e vedere se qualcosa dall'host è montato nella VM? In caso contrario, questo non sarà possibile con una VM. È necessario condividere la cartella host con la VM in un modo che consenta al contenitore di accedervi. –