Dockerfile with custom config

Hi all,

I’m experimenting with a private swarm, and would like to run this containerized. My approach is as follows: I created a Dockerfile like so

FROM ipfs/go-ipfs
COPY swarm.key /data/ipfs/swarm.key
RUN ipfs init \
 && ipfs bootstrap rm --all   # as per the guide

When I build this image and run the container for the first time, the ipfs init command is executed again.

I would like to roll an image with this and more config (like specific ports etc…) so I just have to spin up extra containers within the same subnet (using mDNS)

Not using dedicated docker volumes, since I shouldn’t care whether a peer dies as the redundancy is in the swarm. (side question: how to see the amount of duplicates a block has/how much loss can be tolerated)

Can anyone tell me how to write the Dockerfile in such a way that I can make an image with custom config?

UPDATE: I found out that this is default docker behavior, ie changes to a volume from a Dockerfile after it was defined get discarded (fortunately not so for COPY commands).

What is then the recommended way to customize the image so that one can give additional ipfs config commands on container creation?


1 Like

to disable ipfs init maybe you can change

I’m also looking for this, If you have managed to dockerize the private ipfs swarm network, please share.