I have the following Dockerfile:
FROM ubuntu
ENV NPM_CONFIG_LOGLEVEL warn
ENV admin_user=\"PeerAdmin\" network_name=$1 version=$2 hversion=hlfv1 fabrik_
You can't (*) run Docker inside Docker containers or images. You can't (*) start background services inside a Dockerfile. As you say, commands like systemctl
and service
don't (*) work inside Docker anywhere. And in any case you can't use any host-system resources, including the host's Docker socket, from anywhere in a Dockerfile.
You need to redesign this Dockerfile so that it only installs the software and makes no attempt to start it. Ideally a container would start only a single server, and would run it in the foreground as its CMD; otherwise you might depend on things like supervisord to have multiple servers if you must. If your application heavily relies on being able to start things in Docker, you might find it much easier to install in a virtual machine.
(*) Technically there are ways to do all of these things, but they're all tricky and complicated and have implications (up to potentially giving your container unrestricted root access over the host, and your container startup actively reconfiguring some low-level host details).
Run Docker with sudo
. If that doesn't work, try running the daemon in the following way:
sudo nohup docker daemon -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock &
The error may come from "service docker start". If you want to follow the installation instructions from the upstream vendor for a docker container then you need to prepare the environment for that. I can run these commands easily by using the dockers-systemctl-replacement script.
I had this same issue, run this command in your terminal. This fixed the problem.
sudo apt-get install docker-ce docker-ce-cli containerd.io
Try this cmd:
sudo service docker restart
It might be the case that the user with which you have logged in to docker engine is not having the correct permission. You can add the user to docker group with below command:
sudo usermod -a -G docker $USER
$USER is the username of the currently logged in user. Thanks