I installed docker-compose on Ubuntu v22.10 x64, and it works properly on root account but not my other account.
I added the user account to docker group, and gave docker group permissions to execute docker-compose file. When I run docker compose version from the user account it says that compose is not a docker command.
Did you also run the command newgrp docker or log out and log back in? All of the required post-install steps for Linux can be found here.
Related
I have a fresh install of docker desktop on my machine and I'm attempting to create a dev environment. Using docker.io/library/wordpress:latest
However, I'm having some issues with user permissions. From what I can see the documentation doesn't mention this issue for mac users, but does mention something for ubuntu users (See Doc's). The specific issue is as follows;
// Docker error msg...
chown: invalid group: 'root:docker'
WARNING: Could not change owner for docker socket in container : exit code 1
Docker socket permission set to allow in container docker
// My setup...
macOS BigSir 11.6.5(Intel Chip)
Docker Desktop 4.8.2
VSCode Version: 1.67.1
git version 2.36.1
My Question: How do I resolve this issue? I.e. What steps do I need to take?
Any guidance would be greatly appreciated... 😅
Note: I can see other questions floating around here on stack, but from what I can see they're mostly covering ubuntu users or quite old questions and answers.
Note: Added screenshots to demonstrate what I was doing when the error occurred.
Step 1
Step 2
Step 3 -- Error
Most docker image in public registry is not designed to compatible with Docker Dev Environments (Beta).
According to documentation: https://docs.docker.com/desktop/dev-environments/specify/, specified docker image is required to have docker group and vscode user which already included to the group.
So we need to modify official docker image for your case to be working fine with docker dev environments and visual studio code.
# Dockerfile
FROM docker.io/library/wordpress:latest
# the next two commands are required based on documentation
# https://docs.docker.com/desktop/dev-environments/specify/
RUN useradd -s /bin/bash -m vscode \
&& groupadd docker \
&& usermod -aG docker vscode
USER vscode
Build our new docker image by running docker build, e.g:
docker build -t bickyeric/wordpress:dev-latest -f Dockerfile .
After that, you can update image tag from Step 2 of Question with our new image bickyeric/wordpress:dev-latest
I am new to Docker and after writing docker version in cmd I got this error,
error during connect: This error may indicate that the docker daemon is not running.: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/version": open //./pipe/docker_engine: The system cannot find the file specified.
The following steps solved this problem:
Open cmd as administrator
Launch command: "C:\Program Files\Docker\Docker\DockerCli.exe" -SwitchDaemon
some times docker might be disabled from starting on boot or login so in the windows search bar or when clicking the WinKey and starting to type Dock... like showen in the picture below, Then press Enter to start the Docker Daemon
Try running dockerd in a separate terminal and then try running this command.
To avoid doing this every time you can go to services -> find Docker -> select Startup Type as Automatic (Delayed) and reboot the machine.
Simple Solution: Just open Powershell and type dockerd which will start the daemon and you shall be able to use the docker now without errors.
On Windows, reason behind this issue is that Docker is not started. I tried couple of solution provided on multiple online portal to start it. What worked for me is:
In Docker Desktop if you are already logged in as a user, logout from there
Again login to docker desktop with docker account
When we login to docker account, it internally triggers the restart. So resulting if it's not started, it will start the docker for us.
I had this, but when I used a command shell elevated to Administrator, docker version was fine.
This error may indicate that the docker daemon is not running.: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json": open //./pipe/docker_engine: The system cannot find the file specified.
this error in windows 10
step 1
pls install (https://learn.microsoft.com/en-us/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package) Download the latest package:
this link WSL2 Linux kernel update package for x64 machines
then restart then automatically running
In my case,
I download the this github repo.MaxySpark
Closed all the application related to docker.
1.Click on docker.reg file in the downloaded repo.
2.Click on yes->yes->ok to merge.
3.Again open the Docker Toolbox and run docker run hello-world
Open cmd as administrator
Launch command: C:\Program Files\Docker\Docker\DockerCli.exe -SwitchDaemon
It simply means that your docker application is not running or you have not logged in to docker application, or docker desktop service is not running .
1: Just open Docker desktop application, login with docker credentials.
2: if already logged in and still getting this error, go to windows + r ==> and type 'services.msc', and restart the docker desktop service.
All done.
It can be kernel problem:
You need to update WSL2 Linux kernel update package for x64 machines
Follow this tutorial:
https://linuxhint.com/resolve-docker-daemon-not-running/
and before execute "docker run hello-world" command, dont forget restart docker
https://learn.microsoft.com/en-us/windows/wsl/install-manual
Environment
Windows version and build Version 2004 (OS Build 19037.1)
Docker Edge version 2.1.6.1
Ubuntu 18.04 on WSL 2
Current setup and status:
docker installed on windows
created aliases for docker, docker-compose, docker-credential-desktop, etc ...
Running commands such as docker build, docker ps, docker pull, docker images all work fine. Now I would like push an image and so of course I have to login first.
Problem: logging into docker hub.
I run docker login in the WSL terminal
I put in my username and password
I get the following error
Error saving credentials: error storing credentials - err: exec: "docker-credential-desktop": executable file not found in %PATH
%, out: ``
What I've tried so far
docker login from powershell works fine. So I created a symbolic link between /mnt/c/Users/<winusername>/.docker and /home/<wslusername>/.docker. The equivalent works fine for .aws, but for .docker it was not able to share or even acknowledge the credentials, so it asked again for the user and password and threw the same error as above.
This worked for me,
sudo ln -s /mnt/c/Program\ Files/Docker/Docker/resources/bin/docker-credential-desktop.exe /usr/bin/docker-credential-desktop.exe
Linking the executable from windows path to linux path or you can add the windows PATH on you linux PATH.
Refer: https://github.com/docker/for-win/issues/6652
Update Feb 2021
This is all much simpler now. If you are using WSL2 on a recent release of Windows, just install docker on the Windows side and ensure to configurations:
In General: us the WSL 2 based engine
In Resource/WSL Integration: enable integration with your default WSL distro
You will have to restart docker. Once it is done, everything works transparently.
Below here can be ignored
It turns out that the integration between Docker and WSL is better than I thought. Though it could have been better documented. I was going to change tack and try to install docker in the WSL. So I got rid of all the aliases and restarted my session. Lo and behold, when I ran docker there was still something running.
This is because the edge version of docker create the appropriate symbolic links and now I login into docker hub without any problem.
Although this post is tempted to be closed for many I should ask what I am doing wrong since I am getting crazy and can't find a solution.
I have installed Docker in Fedora 24 and everything seems to be fine but I can't run docker command without sudo and that's annoying (at least for me).
I am logged as a normal user (non-root) and as soon as I run a command I can see this message:
$ docker ps
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
However if I run only docker I can see a list of possible commands :-\
I've followed this guide and I read also a lot (here is a small list):
http://bsaunder.github.io/2014/12/21/running-docker-without-sudo/
Running Docker as non-root user
How to run docker image as a non-root user?
But certainly I am missing something, can any illuminate me? What I am missing here? I know the problem become user has not permissions to /var/run/docker.sock but what's the fix?
Running docker to get the list of commands doesn't use a connection to the daemon, which is why you can run it as non-root.
Have you added your user to the docker group?
sudo usermod -aG docker <my-user>
If you do that, next time you log in you should be able to use the docker CLI without sudo. But beware that the docker group has root privileges, so this is a convenience but not a security improvement.
I am new to the world Docker'm having trouble running the first time.
The facility was quiet, however there trying to check existing container, it shows the following message:
Can not connect to the Docker daemon. Is the running daemon docker on this host?
I've done the start of the daemon to the test reported in the docker documentation I tested is normal and prowling, however to continue the steps displays the message reported above.
By default, the docker command runs for its own group or root users. Make sure you type prefix the command you're using with sudo. Alternatively, you can add your current user to the docker group by running sudo usermod -aG docker $USER.
Source: the official documentation.