https://garden.io logo
Error while mounting volume
b

busy-refrigerator-9901

01/03/2023, 3:49 PM
Hi 👋, I'm trying to mount a volume locally into a container, but it seems to be failing with
Deployment/contact-api-pod: Error: failed to start container "contact-api-pod": Error response from daemon: error while creating mount source 
path '/host/.aws': mkdir /host: file exists
. I'm trying to mount it in a service
services:
  - name: contact-api-pod
    ...
    volumes:
      - name: aws
        hostPath: /host/.aws
        containerPath: /root/.aws
and I'm running
minikube mount $HOME:/host
locally to add the local file to minikube locally. Am I missing something? Thanks in advance!
q

quaint-dress-831

01/05/2023, 3:24 AM
Have you tried just specifying
hostPath
without
minikube mount
?
b

busy-refrigerator-9901

01/05/2023, 2:47 PM
Hi @quaint-dress-831 , you are right it does not throw the error if I don't do the
minikube mount
, but if I don't do it I can't access that file inside the container. Am I missing some other way of sharing a local file into the container? Sorry I'm a bit new to kube!
q

quaint-dress-831

01/05/2023, 2:51 PM
So if you populate a
.aws
file with say the word, "monkeys", and specify that hostPath then exec into the service with
garden exec contact-api-pod bash
is there no
.aws
file with the word monkeys in there?
b

busy-refrigerator-9901

01/05/2023, 3:45 PM
.aws was a folder on my machine, but I tried deleting the kube enviorment with
garden delete env
, creating an .aws file in my local (and renaming my folder), and running garden dev again, but I don't see the file in the container, I see the previous files/folder before my change (but config and credentials are empty folder there instead of files that where on my local machine). It seems like it's not updating the container/image with the new garden dev? Also is hostPath referring to minikube? How can it update it/mount it if my local file is not mounted to minikube? (I might be missing something, as I'm not very familiar with minikube/kube though!)
q

quaint-dress-831

01/09/2023, 3:17 PM
I'll need to create a Minikube testing environment and get back to you.