Docker enable VirtioFS via config file - docker

Is there any way to enable VirtioFS settings for Docker via config file?
enter image description here

While not directly answering your question, I found a way to check if it is enabled at least.
The Docker Desktop settings file has a line that indicates if VirtioFS is enabled or not:
"useVirtualizationFrameworkVirtioFS": true,
The settings file depends on the OS, where is the location for Mac and Linux:
case "$( uname )" in
Darwin)
settings="~/Library/Group Containers/group.com.docker/settings.json"
;;
Linux)
settings="~/.docker/desktop/settings.json"
;;
esac
Changing the setting manually didn't work (it get stuck on "Starting")

Related

The "code" command does not work when connecting to a Docker container remotely with VSCode

I am using VSCode in my local PC and connecting to a Docker container in a remote server with VSCode's Extensions of Remote - SSH and Remote - containers. However, when I type
$ code <file name>
on the VSCode's terminal (Bash), I get an error messages saying that
bash: code: command not found
and I can't edit the file on the VSCode's editor.
If I click on the file from VSCode's Explorer (Ctrl+Shift+E), the edit screen will appear, but isn't it possible to call it with the code command?
Also, I call the command palette (Ctrl+Shift+P) and then search for Shell Command: Install 'code' command in PATH but no matching commands are found.
The execution environment is as follows:.
Local PC: Windows 10 Pro
Remote host PC: Ubuntu 18.04.3 LTS
Docker container in the remote host PC: Ubuntu 18.04.3 LTS
Thank you very much for your answer.
I'll answer myself as I was able to call VSCode using the code command in the remote's container.
When I look closely underneath home, I see that there was a code at the following directory.
$HOME/.vscode-server/bin/<directory with a hash-like name>/bin/
So I passed the PATH through it and it worked.
By the way, <directory with a hash-like name> is a directory with a hash-like name, which is randomly assigned when you connect to the container remotely. It's different every time, so please refer to it by yourself.
The way to register the path is as follows.
export PATH="$PATH:$HOME/.vscode-server/bin/<directory with a hash-like name>/bin/"
Thank you very much for your support.
They posted an easy solution in response to the issue created by #davetapley here.
Go to the VSCode settings, search for "terminal integrated inherit env" and enable the option. The code command will be available the next time you open a terminal.
(This should have been a comment but I don't have that privilege yet!)
Here is what worked for a similar problem where the code command was not working as expected on my Linux system, connected to my windows PC via VSCode's Extensions of Remote - SSH: adding VS Code to PATH by editing the ~/.bashrc file in my linux remote system.
I used the path variable from akki's answer, and the procedure detailed in this answer by oadams.
To edit this file in my system, I use nano:
nano ~/.bashrc
at the end the file, add the export path statement akki mentioned, just without the quotation marks:
export PATH=$PATH:$HOME/.vscode-server/bin/<directory with a hash-like name>/bin/
However, my hashtag-like-name of the code mentioned in akki's answer does not change when I remote SSH to my Raspberry Pi, so I am not sure how to fix that part of the problem.
My execution environment is as follows:
Local PC: Windows 10 on Dell Latitude PC.
Remote host PC: Raspbian GNU/Linux 10 (buster) on Raspberry Pi 3B.
It sounds like you are confusing which place you are writing the code command. Your installation of Visual Studio Code is local on your machine and not inside the docker container. When you open a terminal inside the docker container this is as if it was a different machine altogether. Here is a link to vscode documentation that is both interesting and useful.
Derived from #akki's answer, I noticed that the hash is stored in several environment variables. So I added this to my .zshrc which simply finds the path to the bin and then makes an alias.
VSCODE_SSH_BIN=$(echo "$BROWSER" | sed -e 's/\/helpers\/browser.sh//g')
alias code='$VSCODE_SSH_BIN/remote-cli/code'

Windows doesn't recognize Docker command

I already installed Docker for windows. when I type docker --version command in Command prompt, it doesn't recognize it at all.
The message will be this:
'docker' is not recognized as an internal or external command,
operable program or batch file.
Did I miss something ?
I had installed Docker 18.06.1-ce version on my Windows 10 machine and faced the similar issue, even though the docker was added the Windows %PATH%.
I moved the docker path to the bottom and that solved my problem.
I restarted the system, it worked, maybe we can say that a restart is required.
You need to start the docker first if you have not and then open powershell.
In the powershell, try to run docker commands.
I installed docker Docker version 19.03.13 build 4484c46d9d, in Windows 10 pro 1903.
I was facing the same issue, then I just renamed 'com.docker.cli' to 'docker' and set the environment variable to 'C:\Program Files\Docker\Docker\resources\bin'
Problem Resolved.
Refer the image:
https://drive.google.com/file/d/1sZwx4udOzJeITV2RDGQKlsOt_TF4Wq2N/view?usp=sharing
https://drive.google.com/file/d/1DpW2DR2n_jCGezwrXuhNtXpSTBWmEDJk/view?usp=sharing
Renaming 'com.docker.cli' to 'docker' helped me finally get windows powershell and cmd terminals to recognize the docker command.
Add docker to PATH variable & refreshenv to keep using the same command prompt
If you've installed using docker toolbox the install path "C:\Program Files\Docker Toolbox"
Manually using Environmental Variable > Path (add docker path here)
Using Command Line
For temporary use set PATH=%PATH%;C:\Program Files\Docker Toolbox
Make sure to take a back up of PATH by echo %PATH% before doing this
For permanent change setx PATH=%PATH%;C:\Program Files\Docker Toolbox
docker: command not found
Windows 7: Just set the path of docker in system variable
Step:1
[Click on path -> edit-> paste the docker location]
Step:2 [Paste the docker location]
In my case C:\Program Files\Docker Toolbox.
now check $ docker version
Make sure the docker.exe path (C:\Program Files\Docker\Docker\resources\bin) is added to the PATH variable.
You can check it as follows:
ECHO %PATH%
The docker path had to be appended at the end of the PATH in my case. After that docker cmd was recognized.
Run as administrator worked for me, both powershell and bash on windows. I did not need to restart.
I checked environment variables and noticed that docker path is as the following path in which "R" in resources uppercase. I fixed the case and everything worked as expected
Path: "C:\Program Files\Docker\Docker\Resources\bin"
Just Restart the system, it is always good practice to restart the system when you install or uninstall any application. Hope this works :)
For those who are facing docker issue on VS Code
I was trying on VS Code Terminal after installation. Restarted and was still facing issue.
Then I tried with fresh terminal of Command Prompt -- it worked!
After that it also working fine on vs code.
In VS Code - close all terminals and open fresh terminal
and try test command:
docker --version
2022 - Windows 11
Add these paths to the PATH variable.
C:\Program Files\Docker\Docker\resources\bin
C:\ProgramData\DockerDesktop\version-bin
Docker PATH variable Windows 11:
You need to restart the system after installation. It worked for me.
Try to install GIT bash and then run this command on it for Windows:
base=https://github.com/docker/machine/releases/download/v0.16.0 &&
mkdir -p "$HOME/bin" &&
curl -L $base/docker-machine-Windows-x86_64.exe > "$HOME/bin/docker-machine.exe" &&
chmod +x "$HOME/bin/docker-machine.exe"
Click Here.
there is some issues with PowerShell or new version of docker due to which I was facing the same issue but then I went to this page and got way to run it.
PS: GIT bash is required.
If you have installed Docker Toolbox in your windows, go and add the environment variable.
PATH = "location of folder that contains docker-machine"
I also face a problem with the installation and running docker. I'm not sure you how did you install docker. I tried this way. I've downloaded the docker toolbox (https://github.com/docker/toolbox/releases) which comes up with docker,docker-machine. Oracle Virtual box which is pretty much enough to start docker locally.Please make sure you have git bash installed in your local. Once the toolbox installation is done click the icon generated on the desktop . Make sure this icon target to your Git bash.exe (you can verify this by right click on icon and find target). and verify docker version
For me, I had to ensure the check box Enable Hyper-V Windows Features is checked as I was installing.
I just wanted to have client installed, without the engine. So earlier, as I was installing, I unchecked that option. And after successful installation, I get the error - windows does not recognize docker.
But now that reinstalled with the checkbox checked, things are working fine now.
I noticed that running docker commands before startup causes this issue, but ensuring that docker is running and executing the commands after, they are then recognised.
I facing the same issue when I try to run docker -v in Vscode Terminal after install it. I try to use cmd and git bash it work fine. Restart your vscode will solve it
Unfortunately, After many tries and restarts, I uninstalled docker and Re-installed it again, and I had to build all things again.
I faced the same problem, them I tried in Powershell which works someHo
Download "docker-machine-Windows-x86_64.exe" from: https://github.com/docker/machine/releases
Rename "docker-machine-Windows-x86_64.exe" to "docker-machine.exe".
Copy "docker-machine.exe" to path C:\Program Files\Docker\Docker\resources\bin.
just add this path in your "Path" inside env variables inside windows
C:\Program Files\Docker\Docker\resources\bin
then restart your gitbash or cmd or ...
everything goes well after that !
*just add in your environmental Path this syntax if you did like (install docker in c drive) me, most probably it would work, for me, this passed well.
(note: if you going to call RefreshEnv.cmd or RefreshEnv
through your CMC with Chocolatey, this path would not be created for you, and you have to do it manualy in Windows 10 operating system).
C:\Program Files\Docker\Docker\resources\bin
In my case, I switched to the windows command prompt instead of the VScode terminal.

Change "hosts" / "-h" Docker for Windows in daemon.json

I'm trying to change daemon.json on Docker Desktop for Windows (Windows 10 Aniversary latest updates installed) 1.13.0-rc5 so I can change the "hosts": [] setting like this:
{
"hosts": [
"tcp://0.0.0.0",
"http://0.0.0.0"
]
}
However, after change the settings using the settings app I got this error:
Docker daemon failed with message: unable to configure the Docker
daemon with file C:\ProgramData\docker\config\daemon.json: the
following directives are specified both as a flag and in the
configuration file: hosts: (from flag:
[npipe:////./pipe/docker_engine_windows], from file: [tcp://0.0.0.0
http://0.0.0.0])
Looks like the daemon is already started with -H flag and the json config isn't merged with it.
So, how can we change those settings by either json file or change the dockerd startup parameters?
You have a similar case with issue 22339:
This is expected; you cannot specify options both as a flag and in the configuration file (daemon.json).
If you change your DOCKER_OPTS to DOCKER_OPTS="" and restart, then it should work. We explicitly don't "merge" these configurations.
Or add in docker.conf
[Service]
ExecStart=
ExecStart=/path/to/dockerd
# or
ExecStart=/path/to/dockerd daemon
But the official stance remains:
There's no bug in the systemd configuration, to override defaults in a systemd unit file, you can use a drop-in file, as described in "Custom Docker daemon options".
Producing an error if both a flag and an option in daemon.json are provided was a design decision when implementing that (in general, flags should always have precedence over configuration files); automatically merging options was not an option, as this would lead to unexpected results (was the intent to override an option, or to add to an option?)
PR 27473 was rejected, for issue 21559.

Docker: Looks something went wrong in step Looking for vboxmanage.exe

I just installed Docker Toolbox on my windows 7 machine.
After installing I run the Docker Quickstart terminal which displays the following message:
Looks something went wrong in step nLooking for vboxmanage.exen... Press any key to continue....
Anyone here who knows how to solve this?
Regards,
The same thing happened to me. At this moment I am using Windows Home.
At least in my case, what happened was that the environment variables DOCKER_MACHINE and DOCKER_TOOLBOX_INSTALL_PATH were not created for the system.
I just had to add them and it worked.
Solved the problem by cleaning my .bashrc file.
More specific, i removed the cd , which makes perfectly sense.
For me, the problem was that the DOCKER_TOOLBOX_INSTALLPATH was only set for the user used to escalate priviligies at installation. When I run Docker Quickstart as my regular user, the DOCKER_TOOLBOX_INSTALLPATH variable is empty, producing the error.
Setting DOCKER_TOOLBOX_INSTALLPATH system wide solved the problem.
I'm Windows 8.1 user, I got the same problem when I installing the Docker Toolbox.
Because I have a previous version of VirtualBox installed, so I uncheck the VirtualBox install option in the Docker Toolbox installer.
After the install and I run Docker Quickstart terminal and get the same problem looks like something went wrong in step 'looking for vboxmanage.exe'.
Look at the file D:\Docker Toolbox\start.sh, there are some code fragment:
STEP="Looking for vboxmanage.exe"
if [ ! -z "$VBOX_MSI_INSTALL_PATH" ]; then
VBOXMANAGE="${VBOX_MSI_INSTALL_PATH}VBoxManage.exe"
else
VBOXMANAGE="${VBOX_INSTALL_PATH}VBoxManage.exe"
fi
The start.sh use $VBOX_MSI_INSTALL_PATH and ${VBOX_INSTALL_PATH} Environment Variables to locate the VBoxManage.exe.
And I find my system variables VBOX_MSI_INSTALL_PATH is
D:\VirtualBox
and then, I change it to
D:\VirtualBox\
It works fine!
Or maybe you miss the VBOX_MSI_INSTALL_PATH/VBOX_INSTALL_PATH Environment Variables.
This is my first answer on stackoverflow, I hope this will help you! Finally forgive my poor english ):
For me, it helped to start Docker Quickstart Terminal with admin privileges.
This works if you do not have admin rights:
> Setx DOCKER_MACHINE "C:\Program Files\Docker Toolbox\docker-machine.exe"
> Setx DOCKER_TOOLBOX_INSTALL_PATH "C:\Program Files\Docker Toolbox\\"
> Setx VBOX_MSI_INSTALL_PATH "C:\Program Files\Oracle\VirtualBox\\"
The double backslash in the end makes sure that the variable is saved with one backslash as last character, needed in C:\Program Files\Docker Toolbox\start.sh:
> echo %DOCKER_TOOLBOX_INSTALL_PATH%
C:\Program Files\Docker Toolbox\
Running docker as Administrator solved the problem for me.
I had the same issue.
Inside your toolbox installation folder you should be able to find the installers folder, there you'll find a setup.exe for a Oracle Virtual Box. Double click it, install it and you should be able to reopen the Docker Quickstart with no problems.
Hope this helps!
Cheers! :D
Simple solution: I thought I could just double click on it, but instead need to bring up a windows command prompt, CD to C:\Program Files\Docker Toolbox , and type
sh start.sh
Due to the relative DOCKER_MACHINE path definition on L10, it seems that start.sh will only run when you are inside its directory. I fixed it by modifying the target of the "Docker Quickstart Terminal" shortcut as follows:
C:\Tools\Git\git-bash.exe -c "cd /c/tools/docker; ./start.sh"
Substitute the paths to GitBash and Docker Toolbox to match your installations. If your paths contain spaces, be sure to wrap them in quotes as usual. For example:
"C:\Tools\Git Bash\git-bash.exe" -c "cd '/c/tools/docker toolbox'; ./start.sh"
For context, I had GitBash and VirtualBox already installed before installing Docker Toolbox, so I deselected those options during its install. I'm sure that if I went with the default options, this issue wouldn't have happened. That's probably why some folks on GitHub suggest uninstalling VirtualBox and re-installing Docker Toolbox. Don't do that, it's almost certainly unnecessary.
Do you know how good an open-source program is?
You can actually investigate the issue yourselve, which could be way more precise.
please scroll the quickstart terminal up and see which error message you have got
open C:\Program Files\Docker Toolbox\start.sh (Where you install docker toolbox) with text editer, e.g. sublime text
and see the codes
if it is in step "looking for vboxmange.exe", it should be before STEP="Checking if machine $VM exists" and there are only 50 lines to read
As of 2018-11-27, the only two error that could be given in this step is from these lines, so investigate and find your error in it:
which are:
if [ ! -f "${DOCKER_MACHINE}" ]; then
echo "Docker Machine is not installed. Please re-run the Toolbox Installer and try again."
exit 1
fi
if [ ! -f "${VBOXMANAGE}" ]; then
echo "VirtualBox is not installed. Please re-run the Toolbox Installer and try again."
exit 1
fi
In which:
DOCKER_MACHINE="${DOCKER_TOOLBOX_INSTALL_PATH}\docker-machine.exe"
And
if [ ! -z "$VBOX_MSI_INSTALL_PATH" ]; then
VBOXMANAGE="${VBOX_MSI_INSTALL_PATH}VBoxManage.exe"
else
VBOXMANAGE="${VBOX_INSTALL_PATH}VBoxManage.exe"
fi
So, check your environmental variables and echo it.
In my case, the reason is that DOCKER_TOOLBOX_INSTALL_PATH is an admin user variable:
So, run the quickstart terminal as admin user or put the variable under System variable would do the work
I personally solved this issue by adding the following property to my env (Windows Env variables):
DOCKER_TOOLBOX_INSTALL_PATH=C:\Program Files\Docker Toolbox\
as pointed out by the start.sh script of the Docker Toolbox installation.
You can solve this reinstalling the VirtualBox, choosing repair mode.
C:\Program Files\Docker Toolbox\installers\virtualbox -> virtualbox.exe
enter image description here
After finished the process, restart you machine and smile!
For Windows 7 users:
Change value "C:\Program Files\Oracle\VirtualBox\" to "C:\Progra~1\Oracle\VirtualBox\" for VBOX_MSI_INSTALL_PATH system variable in environment variables.
If you are running docker from admin cmd then just try to scroll up and you will get the error message, and then you can solve the issue.
For me the the error "Docker Machine is not installed. Please re-run the Toolbox Installer and try again."
But unfortunately reinstall did not solve the issue.
I also had this problem on Win 10 Home and I tried probably every solution from this topic but nothing works, only thing that worked for me was hardcoding Path to VBOX in start.sh.
So in start.sh in this part:
STEP="Looking for vboxmanage.exe"
if [ ! -z "$VBOX_MSI_INSTALL_PATH" ]; then
VBOXMANAGE="${VBOX_MSI_INSTALL_PATH}VBoxManage.exe"
else
VBOXMANAGE="${VBOX_INSTALL_PATH}VBoxManage.exe"
fi
I did this:
STEP="Looking for vboxmanage.exe"
if [ ! -z "$VBOX_MSI_INSTALL_PATH" ]; then
VBOXMANAGE="C:\Program Files\Oracle\VirtualBox\VBoxManage.exe"
else
VBOXMANAGE="${VBOX_INSTALL_PATH}VBoxManage.exe"
fi
And this works very well.
I know that this solution(hardcoding path) isn't best possible but it's only one which worked for me, and I think that sometimes it's better to use bad solution which works than good one which didn't work
This happens when the user connects to some sort of secured networks using VPN, TLS machine certs gets messed up, upon restarting machine and regenerating TLS machine certs, docker toolbox is configured to use the default machine with IP 192.168.XX.XX
In windows 8.1, I solved the problem by just adding extra \ to the DOCKER_TOOLBOX_INSTALL_PATH environment variable.
Installer has created the user variable for admin as DOCKER_TOOLBOX_INSTALL_PATH=C:\Program Files\Docker Toolbox
, but it should be
DOCKER_TOOLBOX_INSTALL_PATH=C:\Program Files\Docker Toolbox\
For people that installed docker with chocolatey you need to install VirtualBox separately from docker with choco install virtualbox and set environment variables as this
DOCKER_MACHINE == "C:\Program Files\Docker Toolbox\docker-machine.exe"
DOCKER_TOOLBOX_INSTALL_PATH == "C:\Program Files\Docker Toolbox\"
VBOX_MSI_INSTALL_PATH == "C:\Program Files\Oracle\VirtualBox\"
don't forget to add \ at the end of the folders
I faced same issue on my Windows 7 machine and below steps has resolved the same
Went to C:\Program Files\Docker Toolbox\installers\virtualbox and doubleclick virtualbox.msi to install Oracle Virtual box. (Note : It will install andd ask permission for 3-4 more components, Grant them all)
Set up the Env Variables
DOCKER_MACHINE C:\Program Files\Docker Toolbox\docker-machine.exe
DOCKER_TOOLBOX_INSTALL_PATH C:\Program Files\Docker Toolbox
Restart the machine
Finally Open Docker Quickstart Terminal and give it some minutes (probably 5-10) to let it do the setup
I am having the same issue with the vboxmanage.exe upon running my docker toolbox.
I managed to solve the problem by installing virtualbox since I did not install virtualbox on my computer.
Might as well give it a try.
Docker Tool Box is not a standalone application. It has many other tools like Oracle Virtual Box, Git & docker engine itself.
./start.sh is seeking some existing configuration which might miss in the older version. I updated the GIT version from 2.0.x to 2.12.x & it works for me.

Failed to Create Cookie file RabbitMQ in Windows

I am trying to run the following command
rabbitmq-plugins.bat enable rabbitmq_management
and its giving me an error like this:
11:36:55.464 [error] Failed to create cookie file 'h:/.erlang.cookie': enoent
I am using windows 7, Erlang Version R16B01 and RabbitMQ-Server version 3.1.5
I am using my work PC and our Corporate policy sets the HOMEDRIVE to h: and HOMEPATH to /
and i dont think they will let me change this.
I can see the .erlang.cookie file under C:\Windows.
Could someone let me know of a workaround for this ?
Thanks in advance !
Had the same H: problem. Set the home drive to some dir in the dos shell before executing the cli.
set HOMEDRIVE=C:/conf/rabbitmq :: Or your favorite dir
rabbitmq-plugins.bat enable rabbitmq_management
Use a folder in C drive. The rabbitmq system will write the cookie file there.
I solved the problem by following the steps below:
Open the file: "Program Files/RabbitMQ Server/rabbitmq_server-/sbin/rabbitmq-env"
At the end of the file, append the line:
REM Environment cleanup
set BOOT_MODULE=
set CONFIG_FILE=
set FEATURE_FLAGS_FILE=
set ENABLED_PLUGINS_FILE=
set LOG_BASE=
set MNESIA_BASE=
set PLUGINS_DIR=
set SCRIPT_DIR=
set SCRIPT_NAME=
set TDP0=
set HOMEDRIVE=C: <<< the new path of the .erlang.cookie
Open the RabbitMQ console
write:
4.1. rabbitmq-service stop
4.2. rabbitmq-service remove
4.3. rabbitmq-service install
4.4. rabbitmq-service start
Find location of ".erlang.cookie" in your PC and run the commands bellow:
set HOMEDRIVE=[location of ".erlang.cookie"]
rabbitmq-plugins.bat enable rabbitmq_management
There are cases when your HOMEDRIVE and HOMEPATH get overridden by group policy (active directory user) and than you'll need to set your HOMEDRIVE variable each time you want to start RabbitMQ service. In this case what you can do is:
rabbitmq-service remove service
edit rabbitmq-service.bat file:
"!ERLANG_HOME!\bin\erl.exe" ^
-pa "!RABBITMQ_EBIN_ROOT!" ^
-boot !CLEAN_BOOT_FILE! ^
-noinput -hidden ^
-s rabbit_prelaunch ^
-setcookie "C:\Users\userName\" ^ <<< this is a place of your cookie
!RABBITMQ_NAME_TYPE! rabbitmqprelaunch!RANDOM!!TIME:~9!#localhost ^
-conf_advanced "!RABBITMQ_ADVANCED_CONFIG_FILE!" ^
..."
save the script
set HOMEDRIVE=C:\Users\userName change homedrive before installing service
rabbitmq-service install reinstall the service
now each time your reboot your service starts automatically and all paths are OK!
While this may seem totally obvious, you do need to run cmd "as administrator" - I was getting the above error until I remedied that. :-)
We had the same issue where group policies have set HOMEDRIVE to h: and HOMEPATH to /.
None of the other solutions here worked (even though we have seen that modifying the sys vars did work for us in a different environment).
Today we solved this by creating a new local Administrator account and installing from there.
I got the same error for Z:/ drive which didn't exist on my system. On checking %HOMEDRIVE%, it was mapped to Z:/.
The solution that worked for me was to execute below commands in CMD/Powershell(Admin mode).
mkdir c:/home
net use z: /delete <<--- This might fail as drive z:/ doesn't exist. Just ignore it.
subst z: c:/home

Resources