Skip to content

Docker issue: /ipfs and /ipns are empty within container despite node having pinned files #7922

@pirate

Description

@pirate

I'm not sure if there's a bug with the Docker setup in the README, or if there are missing steps that should be documented.

Despite having a test file uploaded and pinned in my IPFS web dashboard, and the daemon set to mount them automatically, the folders in /ipns (and /ipfs) are empty within Docker and do not contain my test data.

If I try to mount them as volumes on the host, not only are they empty but they don't even contain the empty 12D3K... and local dirs that were visible from within the container.

Screen Shot 2021-02-17 at 3 35 46 p

Screen Shot 2021-02-17 at 3 34 10 p

I have the following docker-compose.yml setup as instructed by the README and this document: https://github.com/ipfs/go-ipfs/blob/master/docs/fuse.md#mounting-ipfs:

version: '2.4'

services:
    ipfs:
        image: ipfs/go-ipfs:latest
        command: daemon --migrate=true --mount
        #privileged: true    # not needed in theory, adding this makes no difference though
        cap_add:
            - SYS_ADMIN
        security_opt:
            - apparmor:unconfined
        devices:
            - /dev/fuse:/dev/fuse
        ports:
            - 8080:8080   # public gateway
            - 4001:4001   # public swarm UDP
            - 5001:5001   # private API
        volumes:
            - /etc/fuse.conf:/etc/fuse.conf:ro
            - ./data/ipfs:/data/ipfs
            - ./data/export:/export
            #- ./data/shares/ipfs:/ipfs  # eventually want to do this, but baby steps first
            #- ./data/shares/ipns:/ipns

/etc/fuse.conf:

user_allow_other

/data/ipfs/config:

...
  "Mounts": {
    "FuseAllowOther": true,
    "IPFS": "/ipfs",
    "IPNS": "/ipns"
  },

When I start the container with docker-compose up it reports that /ipfs and /ipns have been successfully mounted, but they remain empty within the container despite having pinned files.

$ docker-compose up
Creating network "zerviceipfs_default" with the default driver
Creating zerviceipfs_ipfs_1 ... done
Attaching to zerviceipfs_ipfs_1
ipfs_1  | Changing user to ipfs
ipfs_1  | ipfs version 0.8.0-rc2
ipfs_1  | Found IPFS fs-repo at /data/ipfs
ipfs_1  | Initializing daemon...
ipfs_1  | go-ipfs version: 0.8.0-rc2-4080333
ipfs_1  | Repo version: 11
ipfs_1  | System version: amd64/linux
ipfs_1  | Golang version: go1.14.4
ipfs_1  | 2021/02/17 19:50:48 failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB, got: 416 kiB). See https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size for details.
ipfs_1  | Swarm listening on /ip4/127.0.0.1/tcp/4001
...
ipfs_1  | Swarm announcing /ip4/76.71.247.47/tcp/4001
ipfs_1  | API server listening on /ip4/0.0.0.0/tcp/5001
ipfs_1  | WebUI: http://0.0.0.0:5001/webui
ipfs_1  | IPFS mounted at: /ipfs
ipfs_1  | IPNS mounted at: /ipns
ipfs_1  | Gateway (readonly) server listening on /ip4/0.0.0.0/tcp/8080
ipfs_1  | Daemon is ready
$ docker-compose exec --user=root ipfs /bin/sh
 / # whoami
root
/ # ls /ip*s/**
/ipns/12D3KooWCSPrazUW7QNcpvWJh3jaWzErz52SrKC9X6uXqB4XVp4c:

/ipns/local:
/ #

I'm trying to eventually mount /ipfs and /ipns as volumes so that the host OS can write files into them, but I cant even get them working within the container as regular non-volume folders first. The eventually goal is to be able to put a folder into ~/myfiles on the host, and have it automatically uploaded by ipfs within the docker container without having to mess around with the ipfs files cli to add files manually.

Not sure if this ticket means that isn't possible yet: ipfs/roadmap#90 If it's definitely not possible then that should probably also be documented in the README so people don't waste time trying to get mounts working from within Docker. However this issue is specific to the fact that /ipfs and /ipns are empty when they should contain data.

Semi-related issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugA bug in existing code (including security flaws)need/triageNeeds initial labeling and prioritization

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions