Is the docker daemon running? Spring-boot java project on Ubuntu - spring-boot

I have Ubuntu 22.04,
I have Java Spring-boot project, I run Idea, then run docker-compose.yml and get this message:
Cannot connect to the docker daemon at unix:///var/run/docker.sock.
Is the docker daemon running? (Details:[13] Permission denied)
What should I check?

You can take this perfect Tutorial: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-22-04
The important section for you is: Step 2 — Executing the Docker Command Without Sudo (Optional)
Your Problem is that you try to use docker without sudo. You have no permission for that.

Related

Docker Engine not running in Mac M1 series

Problem : I was trying to set up Docker on my Mac M1, docker engine was somehow keep running (it was in kind of hung state). When I tried running docker ps command, I used to get the error "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"
Solution: In Docker Desktop go to settings and try these two steps:-
Clean/purge data
Reset to Factory defaults.
Doing this helped me to fix the issue.

"OCI runtime create failed " issue running script on MacOS using Docker host

I'm trying to run pishrink on MacOS using a Docker host, as explained here. The pishrink script shrinks the size of an .img so it's quicker to burn onto an SD card.
I have Docker Desktop running, and I've add the repo to the top-level in my file system (/pishrink) and and running the following command:
docker-compose run pishrink /pishrink/pishrink.sh /pishrink/big-image.img /pishrink/small-image.img
When I do, I get the following error:
Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "exec: \"/pishrink/pishrink.sh\": permission denied": unknown
Can someone help me debug this issue? I'm relatively new to using Docker so I might be making some simple + fundamental mistakes.
I was able to fix this with the following command, using sudo as suggested:
sudo docker-compose run pishrink /pishrink/pishrink.sh /pishrink/big-image.img /pishrink/small-image.img

Accessing host's host:port from Docker container in OSX

This question may be similar to other questions already answered, but I could not find any that is specific to OSX.
I'm new to Docker. I'm using Docker Version 1.12.1-beta25 (build: 11807) native support for OSX. I wanted to install a Docker Bamboo remote agent, following the instructions at https://confluence.atlassian.com/bamboo/getting-started-with-docker-and-bamboo-687213473.html. My Bamboo server is running on the host.
When running the Docker container with docker run -e HOME=/root/ -e BAMBOO_SERVER=http://hostname:port/bamboo -i -t atlassian/bamboo-java-agent:latest, it failed with Connecting to http://hostname:port/bamboo refused
The problem seems to be that the container could not access the host's http://hostname:port/bamboo. What do I need to do to get this working?
You may try to use http://172.17.0.1:port to find the host from the container. You find this address with docker inspect 'name'.
Or, you can use -p hostPort:containerPort in the docker run command and yse http://localhost:containerPort as Banboo_server

fork/exec ./debug: operation not permitted

My goal is to be able to remote debug from Atom.io. into a docker container running go in dlv debugger. This is the first problem:
Update:1. I am running Docker container on a mac, but that should not influence the code signing thing as I am running in a container, right?
Update:2. Codesignig the host, did not help.
Error:
1. root#...:/go/src/app# go get github.com/derekparker/delve/cmd/dlv
2. root#...:/go/src/app# dlv debug hello.go
could not launch process: fork/exec ./debug: operation not permitted
Then tried to
1. root#...:/go/src/app# sudo
2. bash: sudo: command not found
According Delve Issue #515
Docker has security settings preventing ptrace(2) operations by
default with in the container. Pass --security-opt seccomp:unconfined
to docker run when starting.
*confirmation of this in official docker bug tracker https://github.com/docker/docker/issues/21051
It seems to work if you start the container with --privileged. I've tried to figure out if there is a more fine-grained capability but failed.
Also I just found https://github.com/steeve/homebrew-delve which should make things easier on OSX.
Docker has security settings preventing ptrace(2)
See how i fixed it.
if using a docker-compose file to run the container then append seccomp:unconfined in the services section like below
api:
security_opt:
- seccomp:unconfined
if using docker run ...passing seccomp:unconfined works as well
Run Docker container as a command:
docker run -itd -p 2028:22 -p 2345:2345 --dns=10.236.8.8 --privileged=true --name=golang centos7-golang /usr/bin/supervisord
it works for me~

mesos slave failed to excute docker command

when i start a docker containner on mesos-slave
the mesos-slave log shows that:
I1223 15:38:40.822557 258486272 docker.cpp:761] Starting container 'ea1ed2fa-c2e3-469a-bcc4-142e0a6c624d' for task '2-1.2fb839ea-a948-11e5-9c42-2e7bf2aa25a6' (and executor '2-1.2fb839ea-a948-11e5-9c42-2e7bf2aa25a6') of framework '13165a00-8e58-4d80-b84d-fe4652022a3e-0000'
E1223 15:38:41.219044 254730240 slave.cpp:3342] Container 'ea1ed2fa-c2e3-469a-bcc4-142e0a6c624d' for executor '2-1.2fb839ea-a948-11e5-9c42-2e7bf2aa25a6' of framework '13165a00-8e58-4d80-b84d-fe4652022a3e-0000' failed to start: Failed to 'docker -H unix:///var/run/docker.sock pull python:3': exit status = exited with status 1 stderr = An error occurred trying to connect: Post https:///var/run/docker.sock/v1.19/images/create?fromImage=python%3A3: dial unix /var/run/docker.sock: no such file or directory
from that, i can see mesos-slave excute docker -H unix:///var/run/docker.sock pull python:3 to download images.
but I use Mac OSX, And the docker is running in the vm ,
So there is no docker.sock file in my slave but the vm.
How cuold i solve the issue on Mac OSX? please help me ,thanks!
I had this issue too. I was trying to run zookeeper, mesos, marathon, and friends all in one docker-compose file with my mac.
Trying to run things in marathon would cause the exact error that you got. I discovered that the docker daemon was not running on the slave. All I had to do was start it: docker exec <mesos-slave-container-name> sudo service docker start.
From then on, I was able to run docker containers using marathon.

Resources