Mounted host volume is not writable from host in Azure Pipelines

sai anudeep

I'm mounting a volume from host to container which will not be present at the time of running the docker container.

  volumes:
    - "../foo:/app/foo"

The foo folder will be created by the docker. The container will create additional folders and files inside foo. Similarly one more app inside the host will create additional folders and files inside foo. My expectation is that all the content should be placed inside the foo folder from the container app and the host app.

This works fine in the Mac, but running the same in Azure Pipelines fails to create additional files and folders from the host.

Error: EACCES: permission denied, mkdir './foo'
      at Object.mkdirSync (fs.js:921:3)

I have tried adding z at the end of volume mount but it didn't worked - ../foo:/app/foo:Z. I tried to run chmod, but the operation is not permitted.

Azure Pipeline:

pool:
  vmImage: 'ubuntu-latest'
Jason

You could try this to make a folder on a pipleine:

- task: CmdLine@2
  inputs:
    script: 'mkdir .foo' 
    workingDirectory: System.DefaultWorkingDirectory
   

so that would essentially make a .foo folder in System.DefaultWorkingDirectory/.foo

Now if you then wanted to go into that folder you can do:

- task: CmdLine@2
  inputs:
    script: |
      cd '($System.DefaultWorkingDirectory)/.foo'
      dir

Or you could do to just see the full path to ref in your code:

- task: CmdLine@2
      inputs:
        script: |
          echo '($System.DefaultWorkingDirectory)/.foo'

Then once the file has been made you can mount it using docker an answer here may help with that:

Mounting a host directory to a docker container from yaml/compose file

Essentially you have to switch your steps around.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Running docker on Ubuntu: mounted host volume is not writable from container

Replace a file from host to container with mounted volume

Can a mounted volume in Kubernetes be accessed from the host os filesystem

Understanding host mounted volume changes in Docker

Docker options to remove host mounted named volume

docker data volume vs mounted host directory

Docker doesn't save data in host mounted volume

How to remove mounted Docker volume directory on host without root permissions

Docker permissions development environment using a host mounted volume

mount EBS volume from one host to totally different host

How to mount volume from host to container

Share directory or volume with container from host

How to mount volume from container to host in Docker?

Mount volume from host in Dockerfile long format

How to write into host mounted folder from docker container

Execute PHP files in mounted directory from VirtualBox host system is not working

Docker - check within the container if a directory is mounted from the host or not

Docker: copy data from host to mounted host directory to access it from the running container

How to give non-root user in Docker container access to a volume mounted on the host

Can user privilege of docker container impact permission of host machine on mounted volume in docker-compose.yml?

Mount volume to host

Docker volume and host permissions

Volume that is encrypted and not accessible by host?

Docker MySQL Host Volume

file not created on host after mounted

Orphaned Docker mounted host volumes?

How to find volume files from host while inside docker container?

Container files not updated when changed from the host mapped volume

Volume share from container to host docker-compose