1

I have the following docker run command:


docker run -dit
--privileged
-v $PWD/etc/ipsec.conf:/etc/ipsec.conf:ro
-v $PWD/etc/ipsec.secrets:/etc/ipsec.secrets:ro
-v $PWD/etc/ipsec.d:/etc/ipsec.d:ro
-v $PWD/etc/ipsec.d/certs:/etc/ipsec.d/certs:ro
-v $PWD/etc/strongswan.conf:/etc/strongswan.conf:ro
-v $PWD/etc/strongswan.d/charon-logging.conf:/etc/strongswan.d/charon-logging.conf:ro
-v $PWD/etc/strongswan.d/charon/forecast.conf:/etc/strongswan.d/charon/forecast.conf:ro
-v $PWD/etc/strongswan.d/charon/eap-radius.conf:/etc/strongswan.d/charon/eap-radius.conf:ro
-v $PWD/etc/vpn-certs:/etc/vpn-certs:ro
-v $PWD/etc/smcroute/startup.sh:/etc/smcroute/startup.sh:ro
--name strongswanC$i strongswan-compile


I am mounting a combination of files and folders stored on the host into specific locations inside the container.

I would like to convert this to a Kuberbetes yaml file, but I am stuck on the -v options. All of the mounts can be read only.

How would I do these mounts in the a K8s yaml file. Would HostPath be appropriate?

1 Answers1

1

A little background...

I'm using a Dockerfile to build a local image with two built-from-source packages to get the features I need. So rather than "docker run -it -v something:something, I added the following line to my Docker file:

# Copy the contents of ./etc into the image
COPY $PWD/etc/ /etc/

This will copy the files in my $PWD/etc folder into the image completely removing the need for all of the volume mounts. Works perfectly.