1

When I run printenv one of the returned variables is !::=::\. I noticed that the variable exists because docker does not work correctly with it set.

$ printenv | grep ::
!::=::\

$ docker stack deploy keycloak -c keycloak.yml
unexpected environment "=::=::\\"

This variable only exists if my terminal is launched from the graphical interface. If I launch the same process manually from another terminal, the variable does not exist.

It is not possible to unset the variable in bash.

$ unset !::
bash: :: unrecognized history modifier

$ unset \!::

$ env | grep ::
!::=::\

$ printenv | grep :: | cat -A
!::=::\$

$ set +H

$ unset !::

$ unset \!::

$ env | grep ::
!::=::\

How can I prevent the !::=::\ environment variable from being created when the terminal is launched using the start menu?

The variable exists in both Git-bash (Msys) and MSys2.

2

1 Answer 1

1

This has been reported in the Docker post
docker stack deploy Fails When Run From cmd.exe on Windows with CLI v23+ #4078.

The explanation is that when you run a command from the graphical interface, it is implicitly invokes cmd.exe, which means that it also inherits the environment of CMD.

A user furnished a link to the article What are these strange =C: environment variables? where is found the explanation:

cmd.exe basically keeps special environment variables with blank names to support old MS-DOS functionality. These are the environment variables that Docker stumbles over.

In this spirit, another user has recommended changing the error message from "unexpected environment ..." to "unexpected environment variable ...".

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .