Skip to content

Since docker 1.3.0 / fig 1.0.0 volumes are not mounted when fig up'ing existing containers #622

Closed

Description

@morvans

Since docker 1.3.0 / fig 1.0.0 (I upgraded both at the same time), I cannot fig up my projects without fig rm'ing before.

If I do fig up on already existing (stopper) containers, volumes specified in fig.yml aren't remounted (default docker mounts instead, so empty dirs).

fig rm && fig up recreates everything correctly but for locally built containers this is pretty time consuming.

Activity

  1. mindo commented on Nov 6, 2014

    @mindo

    This also happens with docker 1.3.1 and fig 1.0.1.
    Even more weird is that if a container is ran using fig:

    fig run mycontainer bash

    The volumes are mounted just fine.

  2. dnephin commented on Nov 6, 2014

    @dnephin

    Are you using volumes or volumes_from? A sample fig.yml may help in debugging.

  3. mindo commented on Nov 6, 2014

    @mindo

    My fig.yml:

    
    haproxy:
        build: haproxy
        ports:
            - "80:80"
            - "443:443"
        links:
            - ngx
    
    ngx:
        build: ngx-php
        volumes:
            - var/logs/:/var/log
            - ngx-php/etc/:/etc/nginx
            - myapp/:/var/www
        links:
            - percona
            - memcached
    
    memcached:
        build: memcached
    
    percona:
        build: percona
        ports: 
            - "3306:3306"
        volumes:
            - var/mysql/:/var/lib/mysql
    

    All folders defined as volumes are on the same level as fig.yml.

  4. dnephin commented on Nov 8, 2014

    @dnephin

    This seems correct to me. Some things you could try to debug it:

    • docker inspect the containers when they're up to see what it's doing
    • docker will silently ignore a volume if the path doesn't exist, it's possible it's not doing these relative paths correctly. Maybe try adding a ./ prefix
    • paths in the fig.yml are relative to the current working directory, so if you do something like fig -f somepath/fig.yml it might not work (because the paths will be wrong
  5. nireak commented on Nov 9, 2014

    @nireak

    Perhaps it's a silly question.... but are you using a Virtual Machine to run docker and fig ? If so, do the paths referenced in your "volumes" directives exists inside the VM?

  6. mindo commented on Nov 11, 2014

    @mindo
    cd /to/folder/with/fig.yml
    
    • fig up
        "Volumes": {
            "/etc/nginx": "/var/lib/docker/vfs/dir/6b04e7ee535de76bfd359ad1c08fbe35db3e435c2301c464a7390ba67cfefe63",
            "/var/log": "/var/lib/docker/vfs/dir/17b86c34458c046e15709731c3e3c760e2c766ce113c5b2fd0f7de9aafdcc17b",
            "/var/www": "/var/lib/docker/vfs/dir/11a480315b57b48c6b7f5abaada5741a5656e5febdd3365e40e62f04e94f3be2"
        },
    
    
    • fig run ngx bash
        "Volumes": {
            "/etc/nginx": "/mnt/HG/docker/ngx-php/etc",
            "/var/log": "/mnt/HG/docker/var/logs",
            "/var/www": "/mnt/HG/docker/myapp"
        },
    
    

    I am running this directly on my notebook (ubuntu 14.10, no virtual machine).
    I also tried:

    ngx:
        build: ngx-php
        volumes:
            - ./var/logs/:/var/log
            - ./ngx-php/etc/:/etc/nginx
            - ./myapp/:/var/www
    

    and

    ngx:
        build: ngx-php
        volumes:
            - /mnt/HG/docker/var/logs/:/var/log
            - /mnt/HG/docker/ngx-php/etc/:/etc/nginx
            - /mnt/HG/docker/myapp/:/var/www
    

    and neither worked.

  7. dnephin commented on Nov 11, 2014

    @dnephin

    @mindo this looks like a similar issue to #613. fig up will copy volumes from the previous container when it recreates them. I think if you do: fig stop && fig rm --force -v ngx it should remove those volumes and the next time you create it, it should mount the correct host volumes.

  8. mindo commented on Nov 11, 2014

    @mindo

    @dnephin yes, doing

    fig stop && fig rm && fig build
    

    solves it but only until the next reboot/service docker restart.

    Test run:

    fig rm
    fig build
    fig up
    

    Volumes are mounted just fine.

    fig stop
    fig up
    

    Volumes still work.

    fig stop
    service docker stop
    service docker start
    fig up
    

    Volumes fail to mount! But running:

    fig run ngx
    

    The Volumes work without problems.

  9. schickling commented on Dec 5, 2014

    @schickling

    Same here. Any progress on this?

  10. morvans commented on Dec 5, 2014

    @morvans
    Author

    FWIW, the issue seems fixed for me with docker 1.3.2 / fig 1.0.1

  11. schickling commented on Dec 5, 2014

    @schickling

    I'm using docker 1.3.2 / fig 1.0.1. Still doesn't work for me.

  12. morvans commented on Dec 8, 2014

    @morvans
    Author

    @schickling : yeah, spoke too soon, it still doesn't work for me either eventually.

  13. bercab commented on Dec 12, 2014

    @bercab

    Hello, I have the same issue. Can't bind-mount volumes with fig run nor fig up.

    • fig versions tested: 0.3.2, 1.0.0, 1.0.1 and master
    • docker version: 1.4.0
    • docker-py versions tested: 0.5.3, 0.6.0 (with fig master)

    Running with fig --verbose, I see volume is correctly parsed when passing to client.start():

     binds={u'/test': {u'bind': u'/test', u'ro': False}}
    

    But docker inspect shows volume is not bind-mounted:

        "Volumes": {
            "/test": "/var/lib/docker/vfs/dir/fa2cbf2c4b3a560b9e99dd07b68968b99260a717e4ab4f6371dc88e7aa805414"
        },
    

    I think is not a problem of fig, but a problem of docker-py with newer versions of docker.
    According to docs, binds dict seems correct: http://docker-py.readthedocs.org/en/latest/volumes/
    Maybe docker-py is breaking its API?

    Looking at docs link above, seems that client.create_volume() spects a list of volumes (ej: ['test', ]), but fig is passing a dict:

     volumes={u'/test': {}}
    

    Also seems other projects are running the same issue:
    saltstack/salt#14089

  14. shusugmt commented on Dec 14, 2014

    @shusugmt

    I've faced the exact same issue using

    • Ubuntu 14.04
    • docker 1.4.0, installed from ppa (lxc-docker-1.4.0)
    • fig 1.0.1

    Reverting docker version back to lxc-docker-1.3.3 solved the problem for now.

  15. dnephin commented on Dec 14, 2014

    @dnephin

    @s2ugimot for docker 1.4.0 see #723

  16. 25 remaining items

  17. morvans commented on Feb 13, 2015

    @morvans
    Author

    Ok I'll try to get back to you with a stripped down fig.yml and/or a test case involving docker alone.

  18. dmitry-saritasa commented on Feb 13, 2015

    @dmitry-saritasa

    I can't mount relative folder through fig on centos7:

    [root@localhost using-fig]# uname -a
    Linux localhost.localdomain 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

    [root@localhost fig-master]# fig --version
    fig 1.0.1

    [root@localhost fig-master]# docker version
    Client version: 1.3.2
    Client API version: 1.15
    Go version (client): go1.3.3
    Git commit (client): 39fa2fa/1.3.2
    OS/Arch (client): linux/amd64
    Server version: 1.3.2
    Server API version: 1.15
    Go version (server): go1.3.3
    Git commit (server): 39fa2fa/1.3.2
    [root@localhost fig-master]#

    fig.yml:

    /home/apps/using-fig/fig.yml
    es:
        image: library/elasticsearch:1.4.3
        volumes:
            - elasticsearch:/data
        ports:
            - "9200:9200"
            - "9300:9300"

    [root@localhost using-fig]# pwd
    /home/apps/using-fig

    [root@localhost using-fig]# ls -l
    total 4
    drwxr-xr-x. 3 root root 41 Feb 13 17:30 elasticsearch
    -rwxr-xr-x. 1 root root 141 Feb 13 17:16 fig.yml
    drwxr-xr-x. 2 root root 59 Feb 13 15:32 web

    [root@localhost using-fig]# ls -l elasticsearch/
    total 4
    drwxrwxrwx. 2 root root 6 Feb 13 16:59 data
    -rwxr-xr-x. 1 root root 49 Feb 13 16:23 elasticsearch.yml

    so when I run fig up -d

    [root@localhost using-fig]# fig up -d
    Recreating usingfig_es_1...

    [root@localhost using-fig]# docker ps
    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
    e7f8547a4ad1 library/elasticsearch:1.4.3 "elasticsearch" 5 seconds ago Up 4 seconds 0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp usingfig_es_1

    [root@localhost using-fig]# docker exec -ti usingfig_es_1 bash
    root@e7f8547a4ad1:/# ls -l /data/
    ls: cannot open directory /data/: Permission denied

    however if I change fig to absolute path

    fig.yml:

    /home/apps/using-fig/fig.yml
    es:
        image: library/elasticsearch:1.4.3
        volumes:
            - /elasticsearch/data:/data
        ports:
            - "9200:9200"
            - "9300:9300"

    everything works just fine

  19. nomadster commented on Feb 18, 2015

    @nomadster

    @dnephin I've managed to find some time to check for the bug:

    $ docker version
    Client version: 1.3.2
    Client API version: 1.15
    Go version (client): go1.3.3
    Git commit (client): 39fa2fa/1.3.2
    OS/Arch (client): linux/amd64
    Server version: 1.3.2
    Server API version: 1.15
    Go version (server): go1.3.3
    Git commit (server): 39fa2fa/1.3.2
    ----
    $ fig --version
    fig 1.0.1
    

    I've deleted every single image I had and built them from scratch then run fig up (some container use links, I can provide the fig.yml privately if needed).
    Everything is ok:

    $ nsenter -m -u -p -n -i -t $PID
    container$ ls /var/lib/mysql
    my_db_from_volume_1
    ...
    my_db_from_volume_N
    

    Now I fig stop all the containers and fig up them again (not running fig rm --force)
    And the bugs doesn't happen: everything just works fine.
    All the data is where I wanted it to be.

    Just in case this will happen again later on I've pasted the output of the command you asked here

  20. dnephin commented on Feb 18, 2015

    @dnephin

    Ok, this sounds a lot like re-using old volumes, and might be fixed by #858

  21. morvans commented on Feb 18, 2015

    @morvans
    Author

    @nomadster, if you restart the docker daemon between fig stop and fig up, are the volumes re-mounted correctly ?

  22. nomadster commented on Feb 18, 2015

    @nomadster

    @morvans

    fig stop
    systemctl stop docker #Stopped Docker Application Container Engine
    systemctl start docker #Started Docker Application Container Engine.
    fig up -d container1 #(ups other container via links, same command as above)
    

    Some of the container doesn't start correctly. I suppose because the volumes are not mounted correctly.

  23. morvans commented on Feb 26, 2015

    @morvans
    Author

    FWIW, I updated to docker 1.5.0 and the issue seems to be gone.
    I'm able to fig up stopped containers without fig rm them beforehand, and volumes are re-mounted correctly.

  24. UnknownHero commented on Mar 2, 2015

    @UnknownHero

    yes, 1.4.0 not work , but 1.5.0 work fine

  25. Vrakfall commented on Mar 3, 2015

    @Vrakfall

    @morvans Yeah, I think the problem was mainly coming from docker itself and the last big update was meant to solve big mounting issues.

  26. aanand commented on Mar 3, 2015

    @aanand

    I'm closing this issue as it seems to be a confusion of different reports - if anyone can produce a minimal failing case, please open a new one.

  27. CWSpear commented on Jan 28, 2016

    @CWSpear

    I'm seeing some behavior that seems related and I have a reduced test case here: #2776

  28. knvpk commented on Feb 16, 2016

    @knvpk

    Hi, im experienceing with same problem, after restarting my server the containers are starting but not mounting the volumes, the changes i have done to my server is updated to Ubuntu server 15.10 and docker-compose version is 1.6.0, but when i goto my docker-compose folder and start them then volumes are mounting correctly.

  29. dnephin commented on Feb 16, 2016

    @dnephin

    You might be hitting #2912

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions