Score:1

Converting "docker run -v external_folder:internal_folder

cn flag

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?

cn flag
I'm thinking of doing this unless someone has a better answer: https://stackoverflow.com/a/59670136/2113184
Score:1
cn flag

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.