Bind Mount Additional Volumes for Image in Github Action

Hi,

I am using a self-hosted github-runner on an ec2 machine, and creating an action that will run in a docker image.  For the basic setup, I followed the instructions given here.  

In order for this action to run correctly, I need to bind mount a volume (/var/lib/some_folder) to the same place in the docker image.  I see when the action runs, it mounts several directories.  Is there any way to specify additional ones?

1 Like

Hi @andrewsavino1 ,

You can add volume in github action dockerfile.

# Container image that runs your code
FROM alpine:3.10

# Define the volume
VOLUME ["data1", "data2"]

# Copies your code file from your action repository to the filesystem path `/` of the container
COPY entrypoint.sh /entrypoint.sh

# Code file to execute when the docker container starts up (`entrypoint.sh`)
ENTRYPOINT ["/entrypoint.sh"]

Thanks.

@weide-zhou , I need to mount that volume to a directory in my runner.  is there any way  to do this without editing the runner source code?

Hi @andrewsavino1 ,

Thanks for your reply! According to the github stuff answer in this similar ticket, currently it’s not supported to mount additional volume to a directory for the docker action.