fix: reject / as the -v destination in nerdctl run for Docker com…#4954
Open
haytok wants to merge 1 commit into
Open
fix: reject / as the -v destination in nerdctl run for Docker com…#4954haytok wants to merge 1 commit into
/ as the -v destination in nerdctl run for Docker com…#4954haytok wants to merge 1 commit into
Conversation
…patibility In the current implementation, when specifying `/` as the destination of the `-v` option in the nerdctl run command, the following error occurs but the container is created. ```bash > sudo nerdctl run -d --name nginx -v ./:/ nginx FATA[0000] failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: unable to apply apparmor profile: apparmor failed to apply profile: open /proc/thread-self/attr/exec: no such file or directory > sudo nerdctl ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 0f880e0e68f8 docker.io/library/nginx:latest "/docker-entrypoint.…" 5 seconds ago Created nginx ``` However, in the same situation, Docker fails to create the container. ```bash $ docker run -d --name stop -v ./:/ nginx docker: Error response from daemon: invalid volume specification: '/Users/haytok/workspace:/': invalid mount config for type "bind": invalid specification: destination can't be '/' $ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ``` Therefore, this commit fixes the behavior so that the container creation fails when `/` is specified as the destination of the `-v` option for compatibility with Docker. Signed-off-by: Hayato Kiwata <dev@haytok.jp>
sathiraumesh
approved these changes
Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…patibility
In the current implementation, when specifying
/as the destination of the-voption in the nerdctl run command, the following error occurs but the container is created.However, in the same situation, Docker fails to create the container.
Therefore, this commit fixes the behavior so that the container creation fails when
/is specified as the destination of the-voption for compatibility with Docker.