Docker on ubuntu app for windows 10 starting but not running - docker

I have a windows 10 enterprise laptop.
Installing docker on that machine in the past proved unsuccessful.
As an alternative I have installed the ubuntu app from microsoft store, ubuntu version Ubuntu 18.04.1 LTS.
I then followed the tutorial to install docker ce on ubuntu and everything went smoothly up to running an app.
I installed Docker version 18.09.6, build 481bc77
I did the post-installation for unix, logout using exit and restarted.
It looks like I can start docker:
~$ sudo service docker start
* Starting Docker: docker
But when checking if docker is running for real, it seems that it is not the case:
~$ ps
PID TTY TIME CMD
4 tty1 00:00:00 bash
328 tty1 00:00:00 ps
It is confirmed with the error message when running the hello world image:
$ sudo docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
Is there specificity with Ubuntu app for windows that prevent me from running docker?
Edit: thanks to #atline link, it is mentioned windows does not support running docker daemon within the WSL.
I cannot run docker desktop and hit a wall on below issue closed without being resolved:
https://github.com/docker/for-win/issues/74

You can use this command:
export PATH="$HOME/bin:$HOME/.local/bin:$PATH"
export PATH="$PATH:/mnt/c/Program Files/Docker/Docker/resources/bin"
alias docker=docker.exe
alias docker-compose=docker-compose.exe

Related

docker daemon can't running on ubuntu container

On my windows 11, I install Docker Desktop and ubuntu image.
On ubuntu container, I want install dapr,but dapr depends on docker
dapr init
⌛ Making the jump to hyperspace...
❌ could not connect to Docker. Docker may not be installed or running
so, then I install docker on ubuntu container, but the docker can't run (I have set export DOCKER_HOST=tcp://127.0.0.1:2375). how to solve this issue? Thanks!

docker desktop windows won't install docker daemon for wsl2

[x] I have tried with the latest version of my channel (Stable or Edge)
[x] I have uploaded Diagnostics
Diagnostics ID: 8C2E2B56-0E86-4E49-BAF5-B06DB3F99738/20200712115912
Expected behavior
sudo service docker command ran on wsl2 (4.19.121-microsoft-standard) should print service status
Actual behavior
sudo service docker command prints docker: unrecognized service
Information
Windows Version: 20161.1000, Windows Feature Experience Pack 120.16201.0.0
Docker Desktop Version: 2.3.0.3 (45519)
Are you running inside a virtualized Windows e.g. on a cloud server or on a mac VM: nope
I followed instructions in docker documentation page for wsl so docker can installed to my windows, and checked the command docker run -d -p 80:80 docker/getting-started on ubuntu running successfully, but the service command won't work as described above.
Steps to reproduce the behavior
follow the instructions in here
sudo service docker on wsl2 ubuntu

docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? Linux Bash Shell on windows 10

I am new to Docker. I'm trying to work with it on windows.
I have Windows 10 Family so I installed Linux Bash Shell.
When I run this command:
$ docker run hello-world
I get :
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
And when I run
$ systemctl status docker
I get
System has not been booted with systemd as init system (PID 1). Can't operate
For anyone using WSL2 and seeing an identical error message, look at https://github.com/MicrosoftDocs/WSL/issues/457#issuecomment-511495846
Powershell
wsl -l -v
NAME STATE VERSION
* Ubuntu-20.04 Running 2
Ubuntu
$ docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
$ systemctl status docker
System has not been booted with systemd as init system (PID 1). Can't operate.
$ sudo /etc/init.d/docker start
* Starting Docker: docker [ OK ]
$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete
Digest: sha256:308866a43596e83578c7dfa15e27a73011bdd402185a84c5cd7f32a88b501a24
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
It seems like you wont be able to use docker in Windows 10 family, since docker Desktop requires specific Windows version, as said in official documentation.
System Requirements
Windows 10 64-bit: Pro, Enterprise, or Education (Build 15063 or later).
What you can try is to run linux-based virtual machine on you Windows host, and run docker inside of it. But even if you succeeded, you will lose all advantages of the docker in resources consumption.
Just run the Docker Daemon with.
sudo dockerd &
The sudo make it run as super user.
Dockerd is DOCKERDaemon
The single & at the end just make it run in the background.
The issue here is that from the error message, it states that you are using WSL (Windows Sub-system for Linux Version 1), this version did not have Docker support as it is not a full Linux kernel, but an translation layer between a Linux user-space and then translated to Windows Kernel commands.
Running the wsl --list -v command will show you the version you are using:
You can install WSL version 2, which has a Microsoft provided full Linux Kernel running using Hyper-V infrastructure (but not full Hyper-V). This way it runs on Windows Home, Education, and Professional. And here you can run a Linux Instance and the install Docker.
Windows Subsystem for Linux Installation Guide

Cannot connect to the Docker daemon at tcp://localhost:2375

I have installed docker client on Windows Subsystem for Linux (WSL) on Windows 10.0.17763 Home.
When I run
sudo docker ps
I got:
Cannot connect to the Docker daemon at tcp://localhost:2375. Is the
docker daemon running?
and after removing docker environment variables (unset DOCKER_HOST , unset DOCKER_TLS_VERIFY , unset DOCKER_TLS_PATH), I still have the same issue with docker daemon:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is
the docker daemon running?
When I try to start docker daemon sudo systemctl start docker I am getting:
Failed to connect to bus: No such file or directory
docker version is 19.03.4
docker compose version is 1.24.1
Also restarting LxssManager win service will not help.
What should I do?
WSL is no real Linux Kernel which is why nothing, also running the Windows Subsystem for Linux as administrator by right clicking from start menu and running sudo service docker start does not work.
There is a new version, WSL 2 which is supposed to solve the docker issue but I did not try it our so far: https://docs.docker.com/docker-for-windows/wsl-tech-preview/

initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused in docker image

I am getting
$ sudo initctl list
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
On a docker image that has
$ uname -a
Linux 7276b783e0bf 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/redhat-release
CentOS release 6.10 (Final)
Any ideas what is going on? I thought CentOS6 is using Upstart by default.
You should just broadly assume that commands like initctl (and systemctl and service) don't work in Docker. If you're trying to interactively start some new service in a running Docker container, that's not generally a best practice: you need to write a Dockerfile that causes the service to start on its own when the container starts up, usually by just running the server as a foreground process.
A Docker container runs one process (and its children). Usually that's not an init-type process. If you docker run --rm -it centos:6 and get a GNU bash shell, that shell is the only process that's running in the container. Upstart, systemd, and the assorted other system daemons they start won't be there. (Try ps -e in your shell to see.)
If your actual question is "what Upstart-managed services are running in my CentOS 6 container", the answer is "none".

Resources