0

I'm trying to create a Docker secret as per Docker docs:

$ echo | docker secret create my_secret -

and getting the following:

$ echo 'this is my secret' | docker secret create my-secret -
Error reading content from "-": Incorrect function.

This is running under Docker Toolbox in ConEmu:

$ docker version                                         
Client:                                                  
 Version:      17.07.0-ce                                
 API version:  1.31                                      
 Go version:   go1.8.3                                   
 Git commit:   8784753                                   
 Built:        Tue Aug 29 17:41:05 2017                  
 OS/Arch:      windows/amd64                             

Server:                                                  
 Version:      17.09.0-ce                                
 API version:  1.32 (minimum version 1.12)               
 Go version:   go1.8.3                                   
 Git commit:   afdb6d4                                   
 Built:        Tue Sep 26 22:45:38 2017                  
 OS/Arch:      linux/amd64                               
 Experimental: false     

The behavior manifests itself only for the STDIN option, the command works fine for a file:

$ docker secret create my_secret ./secret.txt
ulec3yck5jpwywg6o7ptxnun7  

$ openssl rand -base64 32 | docker secret create secure-secret -
Error reading content from "-": Incorrect function.  

$ echo "mydatabasepassword" | docker secret create db_pass -
Error reading content from "-": Incorrect function.
Simeon Leyzerzon
  • 18,658
  • 9
  • 54
  • 82
  • Run the command in a bash shell. – BMitch Oct 08 '17 at 19:23
  • Or you can also try an see if ConEmu supports this `echo 'this is my secret' | docker secret create my-secret /dev/stdin` – Tarun Lalwani Oct 08 '17 at 20:43
  • @BMitch: It is docker bash shell. @Tarun Lalwani: `$ echo 'this is my secret' | docker secret create my-secret /dev/stdin open /dev/stdin: The system cannot find the path specified.` – Simeon Leyzerzon Oct 08 '17 at 20:59
  • ConEmu is a terminal. What shell do you use to run your "docker" command? – Maximus Oct 08 '17 at 21:37
  • @Maximus: As I understand, ConEmu automatically configures itself under Tools::Docker when Docker Toolbox is installed. Here's what I see in its Task configuration box: `"%DOCKER_TOOLBOX_INSTALL_PATH%\..\Git\usr\bin\bash.exe"-l -i "%DOCKER_TOOLBOX_INSTALL_PATH%\start.sh" -new_console:t:"Docker"`. Would it be fair to assume that bash is used here? – Simeon Leyzerzon Oct 08 '17 at 22:02
  • Sure. So, run this command outside of ConEmu (without -new_console of course) and check your issue. – Maximus Oct 09 '17 at 16:52
  • @Maximus: I'm not sure I follow. – Simeon Leyzerzon Oct 09 '17 at 22:56
  • 1
    I was facing the same issue on Docker for Windows, using Cmder (which I believe also uses/is conemu, I'm unsure) but was getting the same error, I tried a standard Windows command prompt and it worked fine, however even running Windows Powershell in Cmder wouldn't work, but running the native Windows Powershell command it worked fine – Chris Mar 13 '18 at 11:50

0 Answers0