0

I want to install a package by docker, following instruction in: https://dynamic-fba.readthedocs.io/en/latest/installation.html#installing-from-source

I installed ubuntu and then Docker. But I don't understand what I need to do next. There it is said to type (docker run -it -v ${PWD}:/opt/examples davidtourigny/dfba python3 examples/example1.py). I excatly type it in ubuntu but I get this error:

docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. See 'docker run --help'.

Using alternative method of dockerfile, I also get error. I don't know how to make use of make build, but used build instead following tutorials on the web.

It's my first time using Docker and I don't know what to do.

Any help is very appreciated.

Residue
  • 5
  • 3
  • 1
    Check the link (one of the many) https://stackoverflow.com/questions/44678725/cannot-connect-to-the-docker-daemon-at-unix-var-run-docker-sock-is-the-docker which has answer to your first approach. Most of the time, the same problem would be faced by others and already answered. It would be a good idea to explore before posting new posts. Welcome to the overflow world. – venBigData Oct 14 '20 at 02:14

2 Answers2

0

The Docker application has two components, a back-end server, and a front-end cli. This way you can do cool stuff like control Docker remotely or have orchestration frameworks that manage multiple Docker nodes over the network like Kubernates.

For security, the Docker back-end server is not exposed on a normal TCP port but it uses a unix domain socket (Linux magic that makes a file act as a port) at unix:///var/run/docker.sock.

When you execute docker run -it ... the cli application will attempt to connect to the backend server, but it looks like the daemon/server is probably not running.

Try to check that daemon is running. If you are using systemd you can check with systemctl status docker and start if is stopped with systemctl start docker finally it might be good to enable it to make sure it starts automatically on reboot, you can do that with systemctl enable docker

  • Thanks a lot. When typing (systemctl status/start docker), I get this error:System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down) I had rebooted my PC. – Residue Oct 14 '20 at 08:52
  • This is a wild guess, but are you using Ubuntu on Windows with WSL? If so, you are not supposed to install Docker in Ubuntu but install it in Windows https://docs.docker.com/docker-for-windows/install/. After you install it in Windows you can run the command from Powershell `docker run -it -v $PWD:/opt/examples davidtourigny/dfba python3 examples/example1.py`. You don't really need ubuntu in that case – Nicolas Martinez Oct 14 '20 at 15:40
0

Make sure to start docker service (you can either go for systemctl start docker or reboot your computer).

Once this is done, it is likely that your user has no permissions to communicate with Docker without sudo. Docker has privileged access to your hardware and therefore giving a user the docker group is required for security reasons.

Run:

sudo usermod -aG docker $USER
groupadd docker
docker run hello-world

This will add you to docker group, reflect the changes inmediately and run a sample image from Docker.

If all was okay, the last command should tell you "Hello from Docker".

Marc Sances
  • 2,402
  • 1
  • 19
  • 34
  • Thanks a lot. When typing (systemctl status/start docker), I get this error: (System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down) I had rebooted my PC. – Residue Oct 14 '20 at 08:53
  • Does adding yourself to ``docker`` group work at least? Can you try ``sudo service docker start``? – Marc Sances Oct 14 '20 at 09:12
  • Yes grouping works. Using the command you suggested, it starts Docker, but when I check for its status, it says docker is not running – Residue Oct 14 '20 at 09:56