matthewbaskey
matthewbaskey

Reputation: 1037

getting Docker script to load with git-bash in ConEmu/Cmder

I see the shortcut to Docker on windows is:

C:\Program Files\Git\bin\bash.exe" --login -i "C:\Program Files\Docker Toolbox\start.sh"  

I use git-bash in Cmder/ConEmu.

I want to execute this script when I start in that console, so I have all my terminals in tabs contained in 1 program instead of git-bash here, docker there.

I am having trouble finding the right way to get this .sh file to run. I find the quotes are different than running a new terminal window from a windows shortcut.

I tried:

"C:\Program Files\Git\bin\bash.exe" --login -i "C:\Program Files\Docker Toolbox\start.sh""

returns:

Either VirtualBox or Docker Machine are not installed. Please re-run the Toolbox Installer and try again.
Looks like something went wrong. Press any key to continue...

C:\Windows\System32\cmd.exe /c ""C:\Program Files\Git\bin\bash.exe" --login -i -- C:\Program Files\Docker Toolbox\start.sh"

returns:

bash: C:\Program: No such file or directory

Current directory:

C:\Code\cmder_mini

Command to be executed:

"C:\Windows\System32\cmd.exe" /c ""C:\Program Files\Git\bin\bash.exe" --login -i -- C:\Program Files\Docker Toolbox\start.sh"

ConEmuC: Root process was alive less than 10 sec, ExitCode=127.
Press Enter or Esc to close console...

Upvotes: 3

Views: 2817

Answers (3)

Zeyad Mounir
Zeyad Mounir

Reputation: 59

I found out a good solution to use docker normally in any cmder terminal I open.

Just paste this code in cmderRoot/config/user-profile.cmd

FOR /F "tokens=* USEBACKQ" %%F IN (`docker-machine status`) DO (
  SET machine_status=%%F
)


IF NOT %machine_status% == Running (
   cmd /c "docker-machine start default"
) 

FOR /F "tokens=*" %%i in ('docker-machine env') do @%%i

Upvotes: 1

TechupBusiness
TechupBusiness

Reputation: 121

I found a really easy solution for me: just set the Cmder / ConEmu as the default terminal for console application. After that the Docker Quickstart Terminal opens Cmder/ConEmu directly instead of using the native Windows CMD. :)

You'll find the setting in Settings Dialog (Win+Alt+P or rightclick on the window header bar). Then go to:

Integration -> Default term

Check the checkbox for "Force ConEmu as default terminal for console applications" and press "Save settings".

Upvotes: 4

VonC
VonC

Reputation: 1323573

A git bash.exe should inherit your %PATH% as $PATH

But the docker toolbox Windows start.sh also depends on other environment variables which should be set before the call:

  • DOCKER_MACHINE: path/to/docker-machine.exe (including the exe itself)
  • VBOX_INSTALL_PATH: path to VirtualBox.

Make sure those are defined first, before calling ConEmu and calling your first command.

Upvotes: 1

Related Questions