You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running vagrant up in a folder that begins with an underscore (eg, _foo) using the docker provider that does not explicitely set the name attribute results in an Invalid container name error.
Debug output
It's easy to see the problem so I don't think the debug output is needed since the error lies in the auto container name code of the docker provider.
Expected behavior
It was expected for vagrant up to succeed and bring up the docker container with an auto-generated name.
Actual behavior
A Docker command executed by Vagrant didn't complete successfully!
The command run along with the output from the command is shown
below.
Command: ["docker", "run", "--name", "_foo_default_1722722989", "-d", "-v", ".../_foo:/vagrant", "57ed1512823d6c273d82fe84bf974a3f7b833c2065787e655ae9746719f99866", {:notify=>[:stdout, :stderr]}]
Stderr: docker: Error response from daemon: Invalid container name (_foo_default_1722722989), only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed.
See 'docker run --help'.
Reproduction information
Vagrant version
$ vagrant -v
Vagrant 2.4.1
Host operating system
macOs Sonoma 14.4.1
Guest operating system
Ubuntu 20.04
Steps to reproduce
Create a folder that starts with an underscore (eg _foo)
Create a minimal Dockerfile in that directory (eg _foo/Dockerfile:
FROM ubuntu:20.04
CMD ["sleep", "infinity"]
Create a minimal Vagrantfile in that directory (eg _foo/Vagrantfile) (see the Vagrantfile section for the contents)
You can fix the error and successfully bring up the docker container by adding to the Vagrantfile's docker config block:
Running
vagrant up
in a folder that begins with an underscore (eg,_foo
) using thedocker
provider that does not explicitely set thename
attribute results in anInvalid container name
error.Debug output
It's easy to see the problem so I don't think the debug output is needed since the error lies in the auto container name code of the docker provider.
Expected behavior
It was expected for
vagrant up
to succeed and bring up the docker container with an auto-generated name.Actual behavior
Reproduction information
Vagrant version
Host operating system
macOs Sonoma 14.4.1
Guest operating system
Ubuntu 20.04
Steps to reproduce
_foo
)_foo/Dockerfile
:_foo/Vagrantfile
) (see the Vagrantfile section for the contents)You can fix the error and successfully bring up the docker container by adding to the Vagrantfile's
docker
config block:Which bypasses the auto name generating code.
Vagrantfile
The text was updated successfully, but these errors were encountered: