Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fig caching mounted volumes #836

Closed
jgadbois opened this issue Jan 12, 2015 · 19 comments · Fixed by #858
Closed

Fig caching mounted volumes #836

jgadbois opened this issue Jan 12, 2015 · 19 comments · Fixed by #858

Comments

@jgadbois
Copy link

After updating fig, I'm having a problem where fig seems to be caching the local working directory and using it's own version instead of using my local directory. For instance in my fig.yml I have

  volumes:
    - .:/var/www/html/

But file changes don't show in the web server.

In another project, where a volume is mounted the same way, switching branches in my local directory does not seem to update the code in the mounted volume.

Is this a new configuration item I am missing or something?

@aanand
Copy link

aanand commented Jan 12, 2015

Can you reproduce the bug using just docker run -v ... and not Fig? If so, it's a problem with your setup (if you're using boot2docker or some other VM-based solution, it's possible that your folder sharing isn't working properly).

@Maxim-Filimonov
Copy link

@aanand I'm facing similar issue but only with fig up.

Docker version 1.4.1, build 5bc2ff8
fig 1.0.1
Vagrant 1.7.2

See example(look for BetterErrors config which i have removed locally):

> tail config/environments/development.rb
  # Adds additional error checking when serving assets at runtime.
  # Checks for improperly declared sprockets dependencies.
  # Raises helpful error messages.
  config.assets.raise_runtime_errors = true

  # Raises error for missing translations
  # config.action_view.raise_on_missing_translations = true

  config.cache_store = :memory_store
end

> fig up app
Attaching to app_1
app_1 |   # Raises error for missing translations
app_1 |   # config.action_view.raise_on_missing_translations = true
app_1 |
app_1 |   config.cache_store = :memory_store
app_1 |
app_1 |   # Allow any ip as we are running it in docker container
=== THIS SHOULD NOT BE HERE app_1 |   BetterErrors::Middleware.allow_ip! =======
app_1 | end

> fig run app
  # Adds additional error checking when serving assets at runtime.
  # Checks for improperly declared sprockets dependencies.
  # Raises helpful error messages.
  config.assets.raise_runtime_errors = true

  # Raises error for missing translations
  # config.action_view.raise_on_missing_translations = true

  config.cache_store = :memory_store
end
> docker run -v /vagrant:/myapp <CONTAINER_ID> tail config/environments/development.rb
  # Adds additional error checking when serving assets at runtime.
  # Checks for improperly declared sprockets dependencies.
  # Raises helpful error messages.
  config.assets.raise_runtime_errors = true

  # Raises error for missing translations
  # config.action_view.raise_on_missing_translations = true

  config.cache_store = :memory_store
end

Fig.yml:

app:
  volumes:
    - /vagrant:/myapp
  command: tail config/environments/development.rb
  # dockerfile from getting started with rails
  build: . 
  ports:
    - "8080:3000"

/vagrant is folder synced to local folder using vagrant syncing. I don't think it has anything to do with vagrant as fig run and docker run work without problems

@jgadbois
Copy link
Author

My problem is with fig up as well, I believe.

@Maxim-Filimonov
Copy link

Confirming the same problem with docker-compose 1.1.0-rc2.
Workaround i found so far:
docker-compose rm && docker-compose up

@cpuguy83
Copy link
Contributor

Have you tried with docker 1.5.0?

@Maxim-Filimonov
Copy link

@cpuguy83 yes docker-compose is with docker 1.5.0.

@aanand
Copy link

aanand commented Feb 18, 2015

@Maxim-Filimonov Are there any notable differences if you docker inspect the containers created by Docker and Fig?

@robbernabe
Copy link

Confirming this issue using fig 1.0.1 and docker 1.4.1. The workaround is fig rm --force && fig up

@adamdecaf
Copy link

I confirmed that this is an issue still. The workaround to "rm then up" it worked, but it's less than idea.

adam@ip-10-0-0-78:~$ docker --version
Docker version 1.5.0, build a8a31ef
adam@ip-10-0-0-78:~$ docker-compose --version
docker-compose 1.1.0

@troyastorino
Copy link

I'm also experiencing an issue similar to this. When I remove volumes values in docker-compose.yml, those changes aren't reflected in in the container config. For instance, I removed all volumes from my docker-compose.yml file, but when I looked at container config (in /var/lib/docker/<containerId>/config.json), it still had the old volumes values that had been deleted. The same rm --force workaround fixed my problem as well

There's a key in that config.json file called AppliedVolumesFrom that pointed to an old container, and wasn't getting changed when I changed the docker-compose.yml file. After running docker-compose rm --force && docker-compose up, the newly created container had AppliedVolumesFrom: null. I'm guessing that the issue stems from this value not getting properly flushed by docker-compose when changes are made.

@dnephin
Copy link

dnephin commented Apr 15, 2015

This would be fixed by #858

@sergej-brazdeikis
Copy link

Upgrade to docker-compose 1.2.0 solved the issue 👍

@dnephin
Copy link

dnephin commented May 24, 2015

#858 has been merged into 1.3.0. This should be fixed once that is released.

@dnephin dnephin closed this as completed May 24, 2015
@KamilKopaczyk
Copy link

I experienced this twice today, on 2 different computers.
docker-compose 1.4.0
docker 1.8.1

rm & up helped

@echernyavskiy
Copy link

Also experiencing this issue with docker-compose version 1.5.2, build 7240ff3 but only when there's both volumes and volumes_from directives in the container definition. In other words, directories mounted from another container via volumes_from work as expected, however those mounted from host via volumes do not - the container seems to have it's own version of these directories.

@nathanjosiah
Copy link

I am still experiencing this issue with docker-compose 1.7.0. Has anybody found a workaround?

@aanand
Copy link

aanand commented May 16, 2016

@nathanjosiah Can you provide more details? Does it happen with the Docker CLI as well or just with Compose? What's the output of docker inspect on the problematic container?

@jguillaumes
Copy link

jguillaumes commented May 24, 2016

I've just observed the same behaviour.

The host machine is a macbook running OSX. I'm running the virtualbox-based host (not the xhyve one). The output of docker inspect is as follows:

$ docker inspect pdpbsd
[
    {
        "Id": "be05604fdb42ea133395a374891cc464c7ad6ef3240a0512f75ab58280c43b17",
        "Created": "2016-05-24T18:33:33.502659504Z",
        "Path": "/startup.sh",
        "Args": [],
        "State": {
            "Status": "exited",
            "Running": false,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 0,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2016-05-24T18:35:41.364341108Z",
            "FinishedAt": "2016-05-24T18:36:57.398543373Z"
        },
        "Image": "sha256:3d04572cfd1ec958c8f642d148da6466b1438d480e98cc600aface9748073daa",
        "ResolvConfPath": "/mnt/sda1/var/lib/docker/containers/be05604fdb42ea133395a374891cc464c7ad6ef3240a0512f75ab58280c43b17/resolv.conf",
        "HostnamePath": "/mnt/sda1/var/lib/docker/containers/be05604fdb42ea133395a374891cc464c7ad6ef3240a0512f75ab58280c43b17/hostname",
        "HostsPath": "/mnt/sda1/var/lib/docker/containers/be05604fdb42ea133395a374891cc464c7ad6ef3240a0512f75ab58280c43b17/hosts",
        "LogPath": "/mnt/sda1/var/lib/docker/containers/be05604fdb42ea133395a374891cc464c7ad6ef3240a0512f75ab58280c43b17/be05604fdb42ea133395a374891cc464c7ad6ef3240a0512f75ab58280c43b17-json.log",
        "Name": "/pdpbsd",
        "RestartCount": 0,
        "Driver": "aufs",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": [
                "/Users/jguillaumes/git/simhdocker/test/pdpbsd:/machines"
            ],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {
                "2323/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "11023"
                    }
                ],
                "2324/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "11024"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "StorageOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DiskQuota": 0,
            "KernelMemory": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": -1,
            "OomKillDisable": false,
            "PidsLimit": 0,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "BlkioIOps": 0,
            "BlkioBps": 0,
            "SandboxSize": 0
        },
        "GraphDriver": {
            "Name": "aufs",
            "Data": null
        },
        "Mounts": [
            {
                "Source": "/Users/jguillaumes/git/simhdocker/test/pdpbsd",
                "Destination": "/machines",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
            }
        ],
        "Config": {
            "Hostname": "be05604fdb42",
            "Domainname": "",
            "User": "",
            "AttachStdin": true,
            "AttachStdout": true,
            "AttachStderr": true,
            "ExposedPorts": {
                "2323/tcp": {},
                "2324/tcp": {},
                "2325/tcp": {},
                "2326/tcp": {}
            },
            "Tty": true,
            "OpenStdin": true,
            "StdinOnce": true,
            "Env": [
                "PATH=/simh-bin:/simh-bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "BUILDPKGS=git gcc libc-dev make vde2-dev libpcap-dev linux-headers readline-dev",
                "RUNPKGS=net-tools vde2 vde2-libs libpcap nano readline bash",
                "SIMULATOR=pdp11",
                "SIMDIR=pdpbsd",
                "OSIMAGE=RA81.000.gz"
            ],
            "Cmd": null,
            "Image": "jguillaumes/simh-pdpbsd",
            "Volumes": {
                "/machines": {}
            },
            "WorkingDir": "/machines",
            "Entrypoint": [
                "/startup.sh"
            ],
            "OnBuild": null,
            "Labels": {}
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "11d6c22d418ea5f59494836c970e6a693a6bf385130e51d80d6ce73d53b6c909",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": null,
            "SandboxKey": "/var/run/docker/netns/11d6c22d418e",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "077a23db00eeb276e5e9559b97aa272fdd7775934d647be1153f53f33e831cc2",
                    "EndpointID": "",
                    "Gateway": "",
                    "IPAddress": "",
                    "IPPrefixLen": 0,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": ""
                }
            }
        }
    }
]

The (local) edits I do to /Users/jguillaumes/git/simhdocker/test/pdpbsd/pdp11.ini are not "seen" by the container when I start it. The only way I've got to "refresh" it is:

  • Make a copy of the file from OSX
  • Open a shell into the running container using docker exec -it pdpbsd busybox sh
  • Delete the file from the container shell
  • Close the shell and stop the container
  • Restore the file from the copy

Now, when I restart the container I see the updated file

Version info:

$ docker version
Client:
 Version:      1.11.1
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   5604cbe
 Built:        Wed Apr 27 00:34:20 2016
 OS/Arch:      darwin/amd64

Server:
 Version:      1.11.1
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   5604cbe
 Built:        Wed Apr 27 00:34:20 2016
 OS/Arch:      linux/amd64

@nathanjosiah
Copy link

@aanand If I remember correctly, I ended up restarting the docker-machine and it was fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.