Error while mounting volume
# 🌱|help-and-getting-started
b
Hi 👋, I'm trying to mount a volume locally into a container, but it seems to be failing with
Copy code
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
Copy code
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
Have you tried just specifying
hostPath
without
minikube mount
?
b
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
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
.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
I'll need to create a Minikube testing environment and get back to you.
8 Views