Run the program with Docker - linux

I want to run the program on a VPS server Ubuntu 18.04. It must be run with Docker with this command:
docker run --rm --name aparser -v $(pwd)/aparser:/app -p 9091:9091 -t aparser/runtime./aparser -foreground
But I get an error:
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
Inputting
sudo systemctl status docker.service
I get:
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2022-05-25 09:31:14 UTC; 14min ago
Docs: https://docs.docker.com
Process: 30302 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1 Main PID: 30302 (code=exited, status=1/FAILURE)
May 25 09:31:12 p619677.vps systemd[1]: docker.service: Main process exited,code=exited, status=1/FAILURE
May 25 09:31:12 p619677.vps systemd[1]: docker.service: Failed with result 'exit-code'.
May 25 09:31:12 p619677.vps systemd[1]: Failed to start Docker Application Container Engine.
May 25 09:31:14 p619677.vps systemd[1]: docker.service: Service hold-off time over, scheduling restart.
May 25 09:31:14 p619677.vps systemd[1]: docker.service: Scheduled restart job, restart counter is at 5.
May 25 09:31:14 p619677.vps systemd[1]: Stopped Docker Application Container Engine.
May 25 09:31:14 p619677.vps systemd[1]: docker.service: Start request repeated too quickly.
May 25 09:31:14 p619677.vps systemd[1]: docker.service: Failed with result 'exit-code'.
May 25 09:31:14 p619677.vps systemd[1]: Failed to start Docker Application Container Engine.
lines 1-16/16 (END)

You will run docker daemon before run docker container.
Run command for start docker service
sudo systemctl start docker
After starting docker you can run with your command and sudo if you are not in sudo
sudo docker run --rm --name aparser -v $(pwd)/aparser:/app -p 9091:9091 -t aparser/runtime./aparser -foreground
If systemctl not working for you run
sudo service docker start

This server does not support Docker.

Related

Docker Issue - Failed to start Docker Application Container Engine (code=exited, status=1/FAILURE)

I am fairly new to docker and linux and I am having issue installing and running docker. My system config are
Operating System: Debian GNU/Linux 9 (stretch)
Kernel: Linux 5.13.9.rsk.1-amd64
Architecture: x86-64
I followed official instructions. When I run sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin, it had following error
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package docker-compose-plugin
I also tried, sudo systemctl restart docker, which output
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
Then I tried, sudo systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2022-06-10 23:04:17 CST; 1min 41s ago
Docs: https://docs.docker.com
Main PID: 33878 (code=exited, status=1/FAILURE)
CPU: 111ms
Jun 10 23:04:15 6969-69-696 systemd[1]: docker.service: Unit entered failed state.
Jun 10 23:04:15 6969-69-696 systemd[1]: docker.service: Failed with result 'exit-code'.
Jun 10 23:04:17 6969-69-696 systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Jun 10 23:04:17 6969-69-696 systemd[1]: Stopped Docker Application Container Engine.
Jun 10 23:04:17 6969-69-696 systemd[1]: docker.service: Start request repeated too quickly.
Jun 10 23:04:17 6969-69-696 systemd[1]: Failed to start Docker Application Container Engine.
Jun 10 23:04:17 6969-69-696 systemd[1]: docker.service: Unit entered failed state.
Jun 10 23:04:17 6969-69-696 systemd[1]: docker.service: Failed with result 'exit-code'.
journalctl -xe had a very big output which does not seem related to docker (most outputs are Failed to get GPU/HCU type or it is not a GPU/HCU host which would make sense since it is a remote host machine).
I have looked at other similar questions on stackoverflow and those fixes have not worked for me so far. Please let me know if I should be doing something differently or how can I fix it. I really need to get docker running for my work. Any help will be appreciated.

Docker service hosts config failed to start

I have Debian 10 virtual machine.
And I want to be able to connect to the docker API from another host.
I can connect to docker from other host if I start docker deamon from console
dockerd -H unix:///var/run/docker.sock -H tcp://192.168.3.157
If I try to configure /etc/docker/daemon.json like
{
"hosts": ["unix:///var/run/docker.sock", "tcp://192.168.3.157"]
}
The command systemctl start docker fails. The command systemctl status docker have next output
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2019-11-02 11:32:26 MSK; 1min 10s ago
Docs: https://docs.docker.com
Process: 868 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 868 (code=exited, status=1/FAILURE)
Nov 02 11:32:24 debian-for-docker systemd[1]: Failed to start Docker Application Container Engine.
Nov 02 11:32:26 debian-for-docker systemd[1]: docker.service: Service RestartSec=2s expired, scheduling restart.
Nov 02 11:32:26 debian-for-docker systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Nov 02 11:32:26 debian-for-docker systemd[1]: Stopped Docker Application Container Engine.
Nov 02 11:32:26 debian-for-docker systemd[1]: docker.service: Start request repeated too quickly.
Nov 02 11:32:26 debian-for-docker systemd[1]: docker.service: Failed with result 'exit-code'.
Nov 02 11:32:26 debian-for-docker systemd[1]: Failed to start Docker Application Container Engine.
Nov 02 11:32:53 debian-for-docker systemd[1]: docker.service: Start request repeated too quickly.
Nov 02 11:32:53 debian-for-docker systemd[1]: docker.service: Failed with result 'exit-code'.
Nov 02 11:32:53 debian-for-docker systemd[1]: Failed to start Docker Application Container Engine.
How should I configure the /etc/docker/daemon.json to make my deamon start properly?
I have found the answer.
It's here Unable to start docker after configuring hosts in daemon.json
I have created the file /etc/systemd/system/docker.service.d/override.conf with content
# Disable flags to dockerd, all settings are done in /etc/docker/daemon.json
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd
And then I restarted the service systemctl daemon-reload; systemctl restart docker

Unable to run node app using systemd

This going to be my first node deployment. I have this app which runs fine on my Debian 9 server using this command:
cd /srv/myapp && NODE_ENV=production yarn start
And print out this message:
yarn run v1.6.0
$ babel-node index.js
In order to demonize the app using systemd, I created `/lib/systemd/system/myapp.service:
[Unit]
Description=Myapp
[Service]
ExecStart=/home/john/start.sh
Type=simple
User=john
Restart=on-failure
[Install]
WantedBy=multi-user.target
and in start.sh I have:
cd /srv/myapp && NODE_ENV=production yarn start
Hoewever, when I run systemctl start myapp the node app does not start to listen on port 3000, as expected (netstat -tulpn | grep :3000
returns no results)
# systemctl status myapp
● myapp.service - Myapp
Loaded: loaded (/lib/systemd/system/myapp.service; disabled; vendor preset: enabled
Active: failed (Result: exit-code) since Sun 2018-05-13 06:14:04 EDT; 5s ago
Process: 8852 ExecStart=/home/bob/start.sh (code=exited, status=203/EXEC)
Main PID: 8852 (code=exited, status=203/EXEC)
May 13 06:14:04 9606 systemd[1]: myapp.service: Unit entered failed state.
May 13 06:14:04 9606 systemd[1]: myapp.service: Failed with result 'exit-code'.
May 13 06:14:04 9606 systemd[1]: myapp.service: Service hold-off time over, scheduling
May 13 06:14:04 9606 systemd[1]: Stopped myapp.
May 13 06:14:04 9606 systemd[1]: myapp.service: Start request repeated too quickly.
May 13 06:14:04 9606 systemd[1]: Failed to start myapp.
May 13 06:14:04 9606 systemd[1]: myapp.service: Unit entered failed state.
May 13 06:14:04 9606 systemd[1]: myapp.service: Failed with result 'exit-code'.
I have other variations on myapp.service but could not manage to run node.
What could be wrong here? How can I fix it?
Process: 8852 ExecStart=/home/bob/start.sh (code=exited, status=203/EXEC)
According to systemd.exec(5), this means systemd could not execute the specified file:
203 EXIT_EXEC The actual process execution failed (specifically, the execve(2) system call). Most likely this is caused by a missing or non-accessible executable file.
You should check if /home/bob/start.sh is executable and has correct shebang specified (that is, the first line of your script must be #!/bin/bash).

unable to configure the Docker daemon with file /etc/docker/daemon.json: EOF

I am new to docker and cannot understand these errors. So, Please let me know if any more information is needed.
`$ docker --version`
Docker version 1.12.6, build 88a4867/1.12.6
`$ docker info`
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
`$sudo dockerd`
FATA[0000] unable to configure the Docker daemon with file /etc/docker/daemon.json: EOF
`$sudo systemctl start docker`
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
`$sudo systemctl status docker.service -l`
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2017-07-26 14:30:21 EDT; 8min ago
Docs: http://docs.docker.com
Process: 5835 ExecStart=/usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --authorization-plugin=rhel-push-plugin --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY (code=exited, status=1/FAILURE)
Main PID: 5835 (code=exited, status=1/FAILURE)
Jul 26 14:30:21: Starting Docker Application Container Engine...
Jul 26 14:30:21 dockerd-current[5835]: time="2017-07-26T14:30:21-04:00" level=fatal msg="unable to configure the Docker daemon with file /etc/docker/daemon.json: EOF\n"
Jul 26 14:30:21 systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Jul 26 14:30:21 systemd[1]: Failed to start Docker Application Container Engine.
Jul 26 14:30:21 systemd[1]: Unit docker.service entered failed state.
Jul 26 14:30:21 systemd[1]: docker.service failed.
Please let me know if I need to check anything else.
The file /etc/docker/daemon.json should not be present or if it is present then it should have a valid JSON object. A blank file would create an error. Either delete the file or if you want to have a blank file then have it with below content
{
}
This will create a blank json object
I have same problem. But I am edited the file /etc/docker/daemon.json and added to it some options. If string with option is not last it have to end with comma character(,).
In root user, type :
$ nano /etc/docker/daemon.json
Ff the file show blank or nothing text, then you just add :
{
}
then save and exit.
Then try to restart docker using
$ service docker restart
In my case just remove that's file using this command
$sudo rm /etc/docker/daemon.json
and then restar the service
$sudo systemctl restart docker.service
$sudo systemctl status docker.service

Service docker start not work(daemon), ubuntu-15.10, To run dockerfile with intelliJ

I have installed docker on ubuntu 15.10 but it does not start, these are the console outputs, I'm new with this from docker, try installing docker from this tutorial https://tecadmin.net/install-and-manage-docker-on-ubuntu/
My interest is to be able to run my dockerfile from intellij
service docker start
root#rubnPC:/var/lib/docker# service docker start
Job for docker.service failed because the control process exited with error
code. See "systemctl status docker.service" and "journalctl -xe" for details.
systemctl status docker.service
root#rubnPC:/var/lib/docker# systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset:
enabled)
Active: failed (Result: exit-code) since sáb 2017-06-03 18:24:42 VET; 3min
18s ago
Docs: https://docs.docker.com
Process: 21270 ExecStart=/usr/bin/dockerd -H fd:// (code=exited,
status=1/FAILURE)
Main PID: 21270 (code=exited, status=1/FAILURE)
jun 03 18:24:42 rubnPC systemd[1]: Starting Docker Application Container
Engine...
jun 03 18:24:42 rubnPC dockerd[21270]: time="2017-06-03T18:24:42.614560352-
04:30" le...id"
jun 03 18:24:42 rubnPC systemd[1]: docker.service: Main process exited,
code=exited,...URE
jun 03 18:24:42 rubnPC systemd[1]: Failed to start Docker Application
Container Engine.
jun 03 18:24:42 rubnPC systemd[1]: docker.service: Unit entered failed
state.
jun 03 18:24:42 rubnPC systemd[1]: docker.service: Failed with result 'exit-
code'.
Hint: Some lines were ellipsized, use -l to show in full.
journalctl -xe
root#rubnPC:/var/lib/docker# journalctl -xe
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has begun starting up.
jun 03 18:24:42 rubnPC dockerd[21270]: time="2017-06-03T18:24:42.614560352-
04:30" level=fa
jun 03 18:24:42 rubnPC systemd[1]: docker.service: Main process exited,
code=exited, statu
jun 03 18:24:42 rubnPC systemd[1]: Failed to start Docker Application
Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
jun 03 18:24:42 rubnPC systemd[1]: docker.service: Unit entered failed
state.
jun 03 18:24:42 rubnPC systemd[1]: docker.service: Failed with result 'exit-
code'.
jun 03 18:24:42 rubnPC polkitd(authority=local)[865]: Unregistered
Authentication Agent fo
jun 03 18:31:24 rubnPC polkitd(authority=local)[865]: Registered
Authentication Agent for
jun 03 18:31:24 rubnPC systemd[1]: Listening on Docker Socket for the API.
-- Subject: Unit docker.socket has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.socket has finished starting up.
System-Info
rubn _> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 15.10
Release: 15.10
Codename: wily
Docker version
rubn _> docker version
Client:
Version: 1.12.6
API version: 1.24
Go version: go1.6.4
Git commit: 78d1802
Built: Tue Jan 10 20:32:39 2017
OS/Arch: linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this
host?
Kernel Version
rubn _> uname -a
Linux rubnPC 4.2.0-42-generic #49-Ubuntu SMP Tue Jun 28 21:26:26 UTC 2016
x86_64 x86_64 x86_64 GNU/Linux
UPDATE: dockerfile
# Set the WILDFLY_VERSION env variable ENV WILDFLY_VERSION 10.0.0.Final ENV WILDFLY_SHA1 c0dd7552c5207b0d116a9c25eb94d10b4f375549
ENV JBOSS_HOME /opt/jboss/wildfly
# Add the WildFly distribution to /opt, and make wildfly the owner of the extracted tar content
# Make sure the distribution is available from a well-known place
RUN cd $HOME \
&& curl -O https://download.jboss.org/wildfly/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.tar.gz \
&& sha1sum wildfly-$WILDFLY_VERSION.tar.gz | grep $WILDFLY_SHA1 \
&& tar xf wildfly-$WILDFLY_VERSION.tar.gz \
&& mv $HOME/wildfly-$WILDFLY_VERSION $JBOSS_HOME \
&& rm wildfly-$WILDFLY_VERSION.tar.gz
# Ensure signals are forwarded to the JVM process correctly for graceful shutdown
ENV LAUNCH_JBOSS_IN_BACKGROUND true
# Expose the ports we're interested in
EXPOSE 8080
# Set the default command to run on boot
# This will boot WildFly in the standalone mode and bind to all interface
CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0"]
ADD ROOT.war /opt/jboss/wildfly/standalone/deployments/
/etc/default/docker
# Docker Upstart and SysVinit configuration file
#
# THIS FILE DOES NOT APPLY TO SYSTEMD
#
# Please see the documentation for "systemd drop-ins":
# https://docs.docker.com/engine/articles/systemd/
#
# Customize location of Docker binary (especially for development testing).
#DOCKERD="/usr/local/bin/dockerd"
# Use DOCKER_OPTS to modify the daemon startup options.
#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
# If you need Docker to use an HTTP proxy, it can also be specified here.
#export http_proxy="http://127.0.0.1:3128/"
# This is also a handy place to tweak where Docker's temporary files go.
#export TMPDIR="/mnt/bigdrive/docker-tmp"
Solved
Docker can't connect to docker daemon
Can you post the contents of /etc/default/docker?
It seems you have invalid content that is failing the startup. I'm guessing you have fd:// in it. If you do, just remove that & then try restarting docker just as before.

Resources