当前位置:  开发笔记 > 运维 > 正文

Docker Machine + Docker Compose + Umesntu上的卷

如何解决《DockerMachine+DockerCompose+Umesntu上的卷》经验,为你挑选了0个好方法。

所以我已经在我的Ubuntu 14.04 LTS主机上使用docker-compose开发了一段时间,其中有一个本地VirtualBox提供程序(其中包含boot2docker).

直到最近我才决定尝试使用docker-machine(因为与Pycharm的集成)但是我遇到了一些问题,例如当我保存一些新代码时,docker容器不再自动更新,我认为它因为我注释掉了我的卷在我的docker-compose.yml网络服务,但如果我没有,我会得到一个manage.py not found错误,所以我在这里理解,我应该评论它.

我一直在网上阅读很多东西,我想知道是否有一个好的和简单的方法让Docker-machine在Ubuntu上使用docker-compose很好地玩.

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/

泊坞窗,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
#   /sf/ask/17360801/
#  volumes:
#    - .:/vagrant
  ports:
    - "8000:8000"
  links:
    - "postgis:postgis"

更新:

当我mount在我的虚拟机内运行命令时,我得到:

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)

我的共享文件夹在UI中说文件夹路径是 /home

推荐阅读
手机用户2402851335
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有