0

I currently use a vagrant box as my workspace for devops/cloud development.

vagrant ssh not working in MobaXterm on Windows

I saw this command for vagrant: command /drives/c/HashiCorp/Vagrant/bin/vagrant ssh-config > vagrant-ssh-config && ssh -A -F vagrant-ssh-config default

in the advanced tab of the setting.

I am wanting to use mobaxterm to connect docker container to lighten up the start and requirements for my workspace. How would I do that?

Philip Ruff
  • 11
  • 1
  • 3

2 Answers2

2

To be able to start a shell via MobaXterm on Windows:

  1. Create a new shell from MobaXterm clicking "+" tab Create a shell

  2. Go to your docker install directory:

cd "C:\Program Files\Docker\Docker\Resources\bin"

or with:

cd /drives/c/Program Files/Docker/Docker/Resources/bin

  1. Execute docker exec command with -interactive option only:

./docker.exe exec -i your_docker_container /bin/bash

you are now in your docker container's bash environment, you can type ls for example:

Docker exec command with ls example

If you need to connect to a remote docker instance, adapt docker command to include remote host (-H)

Tested with Windows 10, MobaXterm v10.9, docker v18.09.2.

Note: after testing it during some time MobaXterm does not provide a good support to docker interactive console (bash support). Better use a cmd shell, powershell or similar.

BlouBlou
  • 630
  • 6
  • 13
  • Thank you for the good explanation. Is there an option to list the files in the sidebar e.g. https://i.stack.imgur.com/GSb9R.png ? – Test Apr 04 '22 at 07:47
0

@BlouBlou, thanks a lot for your answer Just adding an information that was usefull for me. When I tried to use: "./docker.exe exec -i your_docker_container /bin/bash" I connected to the terminal, but with blank screen. Tried with "-it" and I've received the message below: "the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty'"

I've found a simple solution in another another question that worked for me, and maybe for other users.. Just add winpty before docker.exe

cd "C:\Program Files\Docker\Docker\Resources\bin"; winpty ./docker.exe exec -ti yourcontainer /bin/bash

worked 100%, so far.

Regards. Delocco