[GH-ISSUE #1548] Bind a specific directory of my host machine inside docker, not just the current directory (--bind) #778

Open
opened 2026-03-01 21:46:17 +03:00 by kerem · 6 comments
Owner

Originally created by @intrd on GitHub (Jan 5, 2023).
Original GitHub issue: https://github.com/nektos/act/issues/1548

Act version

act version 0.2.35

Feature description

Using --bind we can bind the current working dir inside the docker, but I didn't find a way to stay in my working dir and mount a specific directory of my host machine inside a docker path, something like –name=myproj -d -v ~/myproj:/home/user/projects/myproj/ docker command line syntax.

Btw,
Is there any way to configure the docker command line through act?
or.. pre-configure a mount point on the used image?

Thank you guys.

Originally created by @intrd on GitHub (Jan 5, 2023). Original GitHub issue: https://github.com/nektos/act/issues/1548 ### Act version act version 0.2.35 ### Feature description Using `--bind` we can bind the current working dir inside the docker, but I didn't find a way to stay in my working dir and mount a specific directory of my host machine inside a docker path, something like `–name=myproj -d -v ~/myproj:/home/user/projects/myproj/` docker command line syntax. Btw, Is there any way to configure the docker command line through act? or.. pre-configure a mount point on the used image? Thank you guys.
Author
Owner

@erikahansen commented on GitHub (Mar 18, 2023):

This would be quite useful, for instance if you want to mount ~/.aws/ from host machine so we don't need an additional step in workflows to make it work locally, like here: https://github.com/nektos/act/issues/409#issuecomment-1069241315.

<!-- gh-comment-id:1475005074 --> @erikahansen commented on GitHub (Mar 18, 2023): This would be quite useful, for instance if you want to mount `~/.aws/` from host machine so we don't need an additional step in workflows to make it work locally, like here: https://github.com/nektos/act/issues/409#issuecomment-1069241315.
Author
Owner

@ChristopherHX commented on GitHub (Mar 18, 2023):

I think --container-options "-v ~/myproj:/home/user/projects/myproj/" allows this.

These are raw docker options.

The Docker commands you see in the log are not used to interact with docker. Act uses the docker api server not cli.

<!-- gh-comment-id:1475036827 --> @ChristopherHX commented on GitHub (Mar 18, 2023): I think `--container-options "-v ~/myproj:/home/user/projects/myproj/"` allows this. These are raw docker options. The Docker commands you see in the log are not used to interact with docker. Act uses the docker api server not cli.
Author
Owner

@n15831 commented on GitHub (Apr 25, 2023):

Confirmed this works, doing something similar with .azure dir.

<!-- gh-comment-id:1521471545 --> @n15831 commented on GitHub (Apr 25, 2023): Confirmed this works, doing something similar with .azure dir.
Author
Owner

@alexandervlpl commented on GitHub (Jul 30, 2025):

Has anyone gotten this to work in .actrc? I've tried changing line order, with and without =, nothing seems to apply --container-options correctly.

<!-- gh-comment-id:3135062593 --> @alexandervlpl commented on GitHub (Jul 30, 2025): Has anyone gotten this to work in .actrc? I've tried changing line order, with and without `=`, nothing seems to apply `--container-options` correctly.
Author
Owner

@ChristopherHX commented on GitHub (Jul 30, 2025):

actrc follows a different syntax, quotes are forbidden, multiple flags in a line are forbidden

Should be similar to this, not tested by me.

--container-options -v ~/myproj:/home/user/projects/myproj/

Only ${ENV_NAME} is replaced in the value.

If you use container: specify the flags there, then the cli side is dropped.

You may need to replace ~ by ${HOME} and if your path contains quotes then quote it

<!-- gh-comment-id:3135531986 --> @ChristopherHX commented on GitHub (Jul 30, 2025): actrc follows a different syntax, quotes are forbidden, multiple flags in a line are forbidden Should be similar to this, not tested by me. ``` --container-options -v ~/myproj:/home/user/projects/myproj/ ``` Only `${ENV_NAME}` is replaced in the value. If you use `container:` specify the flags there, then the cli side is dropped. **You may need to replace ~ by ${HOME} and if your path contains quotes then quote it**
Author
Owner

@alexandervlpl commented on GitHub (Jul 30, 2025):

Thanks, that works! Also with multiple volumes.

<!-- gh-comment-id:3135579217 --> @alexandervlpl commented on GitHub (Jul 30, 2025): Thanks, that works! Also with multiple volumes.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#778
No description provided.