Continuing the discussion from Cannot transfer between two firewalled machines:
The above thread was very helpful in understanding how the different ports works.
In light of this I’m now trying to expose port 4001 via my docker container. My hope would be that when the container is running, and port 4001 is exposed, my container will be connected the ipfs network and that the files that it has pinned within the container will be accessible via other gateways such as http://gateway.ipfs.io/
Everything seems to be working great until I requested the pinned file from http://gateway.ipfs.io/ipfs/QmbYGdVTJdszMhyqTrAPWFk1ubQ66XsiLHpiGQeRb5qs23 where in the request simply hangs.
IPFS is getting installed in my container via my docker file like so: (below is a snippet taken from the complete Dockerfile)
`ENV IPFS_DIST_URL=https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
IPFS_PATH=/data/ipfs
wget -qO- ${IPFS_DIST_URL} | tar xz -C ~/tmp/ ;
mv ~/tmp/go-ipfs/ipfs /usr/local/bin/ ; rm -rf ~/tmp/*
RUN ipfs --version
RUN mkdir -p /data/ipfs
RUN ipfs init
EXPOSE 4001
EXPOSE 8080
…
`
Then I’m starting docker with docker-compose, like so
version: '2' services: web: build: . image: dll-review-registry volumes: - .:/dll-review-registry ports: - "4567:4567" - "4001:4001" - "8080:8080" env_file: - "github-variables.env" environment: - RACK_ENV=docker links: - mongodb depends_on: - mongodb
I then initiate the daemon in the container like so:
docker exec dllreviewregistry_web_1 ipfs daemon
and the console responds with:
Initializing daemon... Swarm listening on /ip4/127.0.0.1/tcp/4001 Swarm listening on /ip4/172.22.0.3/tcp/4001 API server listening on /ip4/127.0.0.1/tcp/5001 Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Everything seems to be running great. Listening docker ports reads as follows:
docker port dllreviewregistry_web_1 4001/tcp -> 0.0.0.0:4001 4567/tcp -> 0.0.0.0:4567 8080/tcp -> 0.0.0.0:8080
Likewise I can also run
docker exec dllreviewregistry_web_1 ipfs cat QmRmSH4hAn76qGprHUvd9jxv3axoyb9t8cad2A9TogfHgf
and get back the contests of the requested document.
However, if I navigate to http://localhost:8080/ipfs/QmRmSH4hAn76qGprHUvd9jxv3axoyb9t8cad2A9TogfHgf in my browser I get NO response.
Likewise, https://gateway.ipfs.io/QmRmSH4hAn76qGprHUvd9jxv3axoyb9t8cad2A9TogfHgf gives me a page not found.
But if I go inside the container, and run
curl http://localhost:8080/ipfs/QmRmSH4hAn76qGprHUvd9jxv3axoyb9t8cad2A9TogfHgf
then I am able to access the content.
My guess is that the problem lies in discrepancy between the demon listening at 127.0.0.1/4001 and the fact that Docker is mapped to 0.0.0.0:4001.
Any ideas how I can get the daemon to expose ports at 0.0.0.0 instead of 127.0.0.1 or am I overlooking some other big problem??
Thanks for your help.