How do I mount /config and /data in Docker?

1. The problem I’m having:

I am using the Caddy official docker container and this is my very first time using Docker. I setup Portainer to give myself something graphical to assist in administration, but I am still very wet behind the ears when it comes to Docker.

The “How to use this image” section of the page for the image states “This image provides for two mount-points for volumes: /data and /config” but I don’t know that I need to do on the host to provide that. I tried to read on Bind Mounts or Volumes, or how to setup either. If they are Bind Mounts, do I simply create those two directories at the root of my host system’s filesystem?

I am not new to Caddy itself, but I have literally never used Docker before, and this is my first container. If I can get some help with this basic item, I can probably move on from here on my own. I just need to get a little push for momentum.

Thank you.

2. Error messages and/or full log output:

There is nothing to show here

3. Caddy version:

v2.6.4 h1:2hwYqiRwk1tf3VruhMpLcYTg+11fCdr8S3jhNAdnPy8=

4. How I installed and ran Caddy:

a. System environment:

Installed in Docker via Portainer on Debian 12. Everything new as of Yesterday afternoon, when I started from scratch.

b. Command:

Portainer starts it for me, not sure how to answer.

c. Service/unit/compose file:

d. My complete Caddy config:

Have not created this yet. I need to know how to mount the two folders first.

5. Links to relevant resources:

You don’t need to mount those directories. They’re directories that Caddy automatically writes information to. You just need to make sure the volumes are declared so that they’re persisted (i.e. the contents are kept if you stop and remove the container and then later start it up again).

I don’t use Portainer so I can’t answer how to set that up. We do have an example for Docker Compose in the docs: Keep Caddy Running — Caddy Documentation

I recommend you read the official Docker documentation to understand how volumes work Volumes | Docker Documentation

I will read those. Thank you for pointing me in the right direction.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.