How to start Boot2Docker in PowerShell in Windows? - windows

Windows 7/8 has a more advanced command-prompt called PowerShell. This has easy copy paste and scrolling support. Boot2Docker is a simple application for Windows to launch a Docker environment.
Problem is: the Docker environment is launched on the old command prompt, and no advanced options are available. Is there any small technique where we can use PowerShell + Boot2Docker?
Edit: You can refer the latest document reference from Docker. They gave simple guidelines to access Docker shell from Putty and Powershell.
https://docs.docker.com/installation/windows/

I solved this problem in few steps. There can be better solutions as well.
Boot2Docker uses Git shell to launch virtual machine for Virtualbox.
Step 1: Append following to your System PATH (Environment Variables)
C:\Program Files (x86)\Git\cmd;
Step 2: Open Powershell (Run+powershell)
Step 3: Go to your Docker installation folder in powershell and execute following command
sh.exe .\start.sh
Please find out simple shortcut approach to avoid hard copy.

Related

How can I run a robot test suite with Windows environment variable using pycharm terminal?

I setup an environment variable in Windows 10 called ROBOT_HOME and it points to my D:\Robot
When I run the test in my PyCharm terminal I use the following command -
robot --test "Example" %ROBOT_HOME%/test-cases
I require these environment variables as it is used company wide and they all call the same ROBOT_HOME and it needs to be defined in each Windows machine locally for it to work.
I am using the Intellibot#master.dev plugin in PyCharm.
It used to work until yesterday (as part of the robot course I'm going through, we used a diff robot framework plugin for PyCharm and now, even reverting back to the previous plugin, it won't work).
I keep getting "File Or Directory does not exist".
When I run the same command in command prompt, it works.
It used to work in the PyCharm terminal as well, not anymore.
In case it's worth mentioning, the PyCharm terminal is Windows Powershell.
In order to call an environment variable from the Powershell terminal in PyCharm, I needed to use the powershell env variable call -
$env:ROBOT_HOME
To see existing variable, can use the following command -
dir env:

Docker for windows will not start [duplicate]

This question already has answers here:
Docker cannot start on Windows
(59 answers)
Closed yesterday.
I have installed Docker for windows as a complete noob looking to try it out.
I have ensured Hyper-V is enable, virtualisation is enabled also
any time I try and run the docker desktop the whale icon is red and it states that it could not start, and if I try to run a command like from cmd I get teh following error
error during connect: Get
http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.40/images/json: open
//./pipe/docker_engine: The system cannot find the file specified. In
the default daemon configuration on Windows, the docker client must be
run elevated to connect. This error may also indicate that the docker
daemon is not running.
I am at a loss as to how I can trouble shoot.
I have also noticed that the STATE when i list my WSL devices is always set as "Installing" even if I completely uninstall Docker through Add/Remove programs
I have had similar error and solved as follow;
In cmd, on admin mode run below command:
docker-machine restart default
if you see anything like: it is not exist then run: docker-machine create
Then you'll get a message something like:
open C:\User\{User_name}\.docker\machine\machines\default\config.json:
The system cannot find the file specified.
Go to the docker icon which will be on your windows tray (bottom right corner of the desktop)
Right click on the docker icon > Settings > Reset > Restart Docker
This solution worked for me. And reference for this answer:
docker cannot start on windows
Literally do as it says: launch Docker as admin.
Quit Docker, and ensure it is no longer running. You should be able to see if its running in the system tray. Right click -> Quit Docker Desktop
It may take a few seconds for it to stop. Wait for the windows notification:
Navigate to the installation directory, which for me was defaulted to C:\Program Files\Docker\Docker. Launch Docker Desktop.exe as admin
This will open the Docker UI. Wait for Docker to fully start up before attempting to consume its services
I had the same problem and here's how I solved it. Install the Docker and please follow brief instructions...
First - I enabled virtualization from BIOS.
Second - I downloaded and installed Linux kernel update package.
Third - Go to "Turn windows features on and off" window
Check whether following is checked...
* Virtual Machine Platform
* Windows Hypervisor Platform
* Windows Subsystem for Linux
You need to restart the PC and Docker will be working.
Please refer the following link and it will definitely give you more information - https://docs.docker.com/docker-for-windows/install/
Go to Powershell (run as administrator), and run this lines
cd "C:\Program Files\Docker\Docker"
./DockerCli.exe -SwitchDaemon
check if it set on Linux containers overwise switch to Linux
Have you tried running Docker using WSL2?
https://docs.docker.com/docker-for-windows/wsl/

Have WSL shell open to project directory in Windows Visual Studio Code

I have a windows subsystem for Linux Installed on my computer and am using it as the integrated terminal on Visual Studio Code. Every time I open a terminal however, it opens in the root directory rather than the current project directory like other terminals do.
Does anyone know of a fix for this?
I have tried messing with the Cwd of the integrated terminal settings but haven't had any luck.
Try using wsl.exe as the command for shell.
"terminal.integrated.shell.windows": "wsl.exe"
I know that is very late for this answer, but for me it just worked.
I put exactly as above and it launched in my home directory (that is /mnt/d/Users/Adrian).
I have the user setup of VSC, 1.30.1 and launch it from the Desktop shortcut.
After I configured terminal as wsl I go as below:
If I open a cmd windows I can launch it with code . it will launch in Windows home directory.
If move to some other folder (e.g Documents) and launch it with code . the bash will launch to that folder.
Otherwise I can launch it with code D:\Users\Adrian\Documents\VSC and the bash terminal will launch in \mnt\D\Users\Adrian\Documents\VSC
Tested the change both via menu File->Preferences->Settings and with Ctrl+Shift+P (Command Pallete), Terminal: Default Shell.
Tried with bash and wsl.
Maybe you have some other bash installed in the path? (e.g. git bash or MinGW bash?)

Launching Explorer from WSL

start . is used to launch an explorer window from cmd.
When doing the same from wsl, I get
$ start . start: Unable to connect to system bus: Failed to connect to
socket /var/run/dbus/system_bus_socket: No such file or directory
Is there an easy way to fix this?
Since Creators Update you can call Windows executables from WSL if you add the extension file. You can open the present folder like this.
explorer.exe .
If you still need start then you can create an alias
alias start='cmd.exe /c start'
then start . will work too.
You can call Windows executables from WSL but you should add the extension of the file too. also there is another problem that in wsl when you want to open a directory in the file explorer, you should use explorer.exe \\home\\username\\projects\\ command because windows cannot understand linux standard path slashes. so, I made a wrapper to solve all of these problems. this project is a wrapper between the Linux command-line and windows file-explorer that converts / to \\.
with this wrapper you can interact with the windows file-explorer exactly like the linux-native one. the below box exhibits the way you can open file explorer using this wrapper.
explorer /home/

Bash on Windows - debug a python file with Visual Code or Visual Studio

I have a python file in my Bash on Windows environment.
Is it possible to debug it with Visual Code or Visual Studio?
Can a debugger be attached to the Linux python version that exists in the Bash on Windows environment?
I think you've got a few options for this. If you're attempting to debug a python file that's saved on your home directory in Bash on Windows, you can navigate to your home directory in Windows by going to "C:\Users\[windows username]\AppData\Local\lxss\home\[ubuntu username]\". Then you can open any of your projects or files saved on your home folder in Ubuntu. You can even make a shortcut on your desktop or something to make it easier to access this folder.
However, if you need the environment that you have on Bash for dependencies or python modules, your other option is to install a GUI and Linux-compatible IDE of your preference on Ubuntu, and use Xming on Windows to run the IDE on your screen. A tutorial on how to do this can be found here.
If you need to debug a linux python program from Visual Studio, a simple Google search yielded this. I haven't tried it but this seems to be the solution you are looking for. For connecting over the network to Bash on Windows from Windows, use localhost for the host.
Your best bet might be to just move the file. Your normal windows system is mounted under /mnt/c.
You can just copy it to your desktop by doing
cp (path to your file) /mnt/c/(your username)/Desktop
When you need to access or edit it from bash, just cd to that location (or wherever else you choose to store it).
Interesting other idea: you could mount cloud storage (e.g. google drive) via fuse in linux then set it up in windows. Copy the python to it and you can edit in windows and access in linux as needed. (Google is your friend here; look into google-drive-ocamlfuse or gdrivefs).
Hope this helps!
jBit
I would suggest making use of the Remote - WSL extension for Visual Studio code. It allows you to easily access your Windows Subsystem for Linux (WSL) and use it as a full-time dev environment.
Here is an article on how to set up Visual Studio Code Remote-WSL.
After that is set up, you can quickly load your python file in the VS Code editor using a command like: code path/to/python_file.py

Resources