I have system requirement below:
Ubuntu 16.04
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
Rails 4.2.5
i can run command bundle exec sidekiq -q queue inside my project without error. Unfortunately when i try to create system service with following filename single_profile_crawl_worker.service:
[Unit]
Description=sidekiq
[Service]
WorkingDirectory=/home/jaisanas/Documents/work/myproject
ExecStart=/home/jaisanas/.rvm/gems/ruby-2.2.1#scraper/bin/bundle exec sidekiq -q tahilalat
[Install]
WantedBy=multi-user.target
then i run command:
sudo systemctl start single_profile_crawl_worker.service
then when i check the service status, by following command:
sudo systemctl status single_profile_crawl_worker.service
it returns error like below:
single_profile_crawl_worker.service - sidekiq
Loaded: loaded (/etc/systemd/system/single_profile_crawl_worker.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Kam 2018-08-09 14:13:43 WIB; 5s ago
Process: 9822 ExecStart=/home/jaisanas/.rvm/gems/ruby-2.2.1#scraper/bin/bundle exec sidekiq -q tahilalat (code=exited, status=127)
Main PID: 9822 (code=exited, status=127)
Agu 09 14:13:43 jaisanas-X456URK systemd[1]: Started sidekiq.
Agu 09 14:13:43 jaisanas-X456URK bundle[9822]: /usr/bin/env: ‘ruby_executable_hooks’: No such file or directory
Agu 09 14:13:43 jaisanas-X456URK systemd[1]: single_profile_crawl_worker.service: Main process exited, code=exited, status=127/n/a
Agu 09 14:13:43 jaisanas-X456URK systemd[1]: single_profile_crawl_worker.service: Unit entered failed state.
Agu 09 14:13:43 jaisanas-X456URK systemd[1]: single_profile_crawl_worker.service: Failed with result 'exit-code'.
it said /usr/bin/env: ‘ruby_executable_hooks’: No such file or directory. Then i've tried several solution like installing ruby_executable_hooks by running sudo gem install --user-install executable-hooks it doesn't work, anyone know what's wrong with my steps create this sidekiq system service ?
Related
I have the following Dockerfile:
FROM ubuntu
ENV NPM_CONFIG_LOGLEVEL warn
ENV admin_user="PeerAdmin" network_name=$1 version=$2 hversion=hlfv1 fabrik_path=/fabric-tools project_dir=$(pwd)
ENV card_store_dir=$project_dir/.card-store stage_dir=$project_dir/.stage env_dir=$project_dir/env is_ok=1 FABRIC_VERSION=hlfv1
WORKDIR /app
COPY . /app
USER root
# RUN chown -R ubuntu:ubuntu .
WORKDIR /app
RUN apt-get update && \
mkdir "$fabrik_path" && \
cd "$fabrik_path" && \
export FABRIC_VERSION=hlfv1 && \
apt-get -y install apt-transport-https ca-certificates curl software-properties-common && \
apt-get -y install curl && \
apt-get -y install unzip && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \
apt-get -y install docker.io && \
curl -O https://raw.githubusercontent.com/hyperledger/composer-tools/master/packages/fabric-dev-servers/fabric-dev-servers.zip && \
unzip fabric-dev-servers.zip && \
service docker start && \
./downloadFabric.sh && \
./startFabric.sh
Attempting to execute it, I am receiving an error:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Commands like service docker start or systemctl do not work.
Try this cmd:
sudo service docker restart
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).
Launch the Terminal and execute the commands below:
$ sudo service --status-all
$ sudo service docker start
https://appuals.com/cannot-connect-to-the-docker-daemon-at-unix-var-run-docker-sock/
Solution 4: Start Docker with the Service command
1. Check the docker.service
sudo systemctl status docker
output is something like this:
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/docker.service.d
└─http-proxy.conf
Active: active (running) since Sat 2021-12-04 19:11:03 +0330; 2min 59s ago
Docs: https://docs.docker.com
Main PID: 28223 (dockerd)
Tasks: 29
CGroup: /system.slice/docker.service
└─28223 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Dec 04 19:11:03 elitedesk dockerd[28223]: time="2021-12-04T19:11:03.813464635+03:30" level=info msg="New memberlist node - Node:elitedesk will use memberlist nodeID:57d6b077dc1b with config:&{NodeID:57d6b077dc1b Hostname:elitedesk BindAddr:0.0.0.0 AdvertiseAddr:192.168.1.45 BindPort:0 Keys:[[214 188 67 83 106 206 215 54 212 222 237 172 208 101 235 219] [232 26 246 100 135 196 113 220 147 95 50 132 140 206 7 126] [236 55 254 140 107 62 111 184 64 103 33 77 246 154 26 50]] PacketBufferSize:1400 reapEntryInterval:1800000000000 reapNetworkInterval:1825000000000 StatsPrintPeriod:5m0s HealthPrintPeriod:1m0s}"
Dec 04 19:11:03 elitedesk dockerd[28223]: time="2021-12-04T19:11:03.813277123+03:30" level=info msg="Daemon has completed initialization"
Dec 04 19:11:03 elitedesk dockerd[28223]: time="2021-12-04T19:11:03.813269814+03:30" level=info msg="initialized VXLAN UDP port to 4789 "
Dec 04 19:11:03 elitedesk dockerd[28223]: time="2021-12-04T19:11:03.814239176+03:30" level=info msg="Node 57d6b077dc1b/192.168.1.45, joined gossip cluster"
Dec 04 19:11:03 elitedesk dockerd[28223]: time="2021-12-04T19:11:03.814424565+03:30" level=info msg="Node 57d6b077dc1b/192.168.1.45, added to nodes list"
Dec 04 19:11:03 elitedesk systemd[1]: Started Docker Application Container Engine.
Dec 04 19:11:03 elitedesk dockerd[28223]: time="2021-12-04T19:11:03.891119330+03:30" level=info msg="API listen on /var/run/docker.sock"
Dec 04 19:11:03 elitedesk dockerd[28223]: time="2021-12-04T19:11:03.964000220+03:30" level=error msg="error reading the kernel parameter net.ipv4.vs.conn_reuse_mode" error="open /proc/sys/net/ipv4/vs/conn_reuse_mode: no such file or directory"
Dec 04 19:11:03 elitedesk dockerd[28223]: time="2021-12-04T19:11:03.964029536+03:30" level=error msg="error reading the kernel parameter net.ipv4.vs.expire_nodest_conn" error="open /proc/sys/net/ipv4/vs/expire_nodest_conn: no such file or directory"
Dec 04 19:11:03 elitedesk dockerd[28223]: time="2021-12-04T19:11:03.964042003+03:30" level=error msg="error reading the kernel parameter net.ipv4.vs.expire_quiescent_template" error="open /proc/sys/net/ipv4/vs/expire_quiescent_template: no such file or directory"
If seemed to have an error, restart it:
sudo systemctl restart docker
And check the status again. If did not solve, next
2. Request to the daemon's socket, see if it is up:
curl --unix-socket /var/run/docker.sock http://localhost/_ping; echo
Output is just OK message
OK
If did not get OK and got something like this:
curl: (7) Couldn't connect to server
3. Check the socket service
sudo systemctl status docker.socket
And a fine output will be:
● docker.socket - Docker Socket for the API
Loaded: loaded (/lib/systemd/system/docker.socket; enabled; vendor preset: enabled)
Active: active (running) since Sat 2021-12-04 19:10:57 +0330; 6min ago
Listen: /var/run/docker.sock (Stream)
Tasks: 0 (limit: 4915)
CGroup: /system.slice/docker.socket
Dec 04 19:10:57 elitedesk systemd[1]: Starting Docker Socket for the API.
Dec 04 19:10:57 elitedesk systemd[1]: Listening on Docker Socket for the API.
And restart it even if it looked good. Because after stopping the daemon and start it again, it does not work and we should (as long as I know) restart docker.socket.
sudo systemctl restart docker.socket
Yet you were not able to fix it? next:
4. Run the daemon directly in debug mode
sudo dockerd -D -l debug
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
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.
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.
if you install docker with deb files, probably not install docker cli. So after install docker, install docker cli, #Jayanth's answer
I've been trying to install Docker on Ubuntu 16.04, but it throws me an error that I am unable to resolve myself.
Using the install script located at get.docker.com:
root#m2dcs44rnq:~# wget -qO- https://get.docker.com/ | sh
# Executing docker install script, commit: 92d5116
+ sh -c apt-get update -qq >/dev/null
+ sh -c apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
+ sh -c curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | apt-key add -qq - >/dev/null
+ sh -c echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial edge" > /etc/apt/sources.list.d/docker.list
+ [ ubuntu = debian ]
+ sh -c apt-get update -qq >/dev/null
+ sh -c apt-get install -y -qq --no-install-recommends docker-ce >/dev/null
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
invoke-rc.d: initscript docker, action "start" failed.
dpkg: error processing package docker-ce (--configure): subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)
Output of systemctl status docker.service:
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: inactive (dead) (Result: exit-code) since Sun 2018-04-22 18:26:04 EDT; 24s ago
Docs: https://docs.docker.com
Process: 13857 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
Main PID: 13857 (code=exited, status=1/FAILURE)
Apr 22 18:26:04 m2dcs44rnq systemd[1]: Failed to start Docker Application Container Engine.
Apr 22 18:26:04 m2dcs44rnq systemd[1]: docker.service: Unit entered failed state.
Apr 22 18:26:04 m2dcs44rnq systemd[1]: docker.service: Failed with result 'exit-code'.
Apr 22 18:26:04 m2dcs44rnq systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Apr 22 18:26:04 m2dcs44rnq systemd[1]: Stopped Docker Application Container Engine.
Apr 22 18:26:04 m2dcs44rnq systemd[1]: docker.service: Start request repeated too quickly.
Apr 22 18:26:04 m2dcs44rnq systemd[1]: Failed to start Docker Application Container Engine.
Of journalctl -xe:
-- Unit docker.socket has begun starting up.
Apr 22 18:47:58 m2dcs44rnq 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.
--
-- The start-up result is done.
Apr 22 18:47:58 m2dcs44rnq systemd[1]: docker.service: Start request repeated to
Apr 22 18:47:58 m2dcs44rnq systemd[1]: Failed to start Docker Application Contai
-- 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.
Apr 22 18:47:58 m2dcs44rnq systemd[1]: docker.socket: Unit entered failed state.
Apr 22 18:47:59 m2dcs44rnq sshd[15811]: Failed password for invalid user backupp
Apr 22 18:48:00 m2dcs44rnq sshd[15811]: Received disconnect from 2.236.185.188 p
Apr 22 18:48:00 m2dcs44rnq sshd[15811]: Disconnected from 2.236.185.188 port 587
lines 1706-1728/1728 (END)
--
-- Unit docker.socket has begun starting up.
Apr 22 18:47:58 m2dcs44rnq 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.
--
-- The start-up result is done.
Apr 22 18:47:58 m2dcs44rnq systemd[1]: docker.service: Start request repeated too quickly.
Apr 22 18:47:58 m2dcs44rnq 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.
Apr 22 18:47:58 m2dcs44rnq systemd[1]: docker.socket: Unit entered failed state.
Apr 22 18:47:59 m2dcs44rnq sshd[15811]: Failed password for invalid user backuppc from 2.236.185.188 port 58738 ssh2
Apr 22 18:48:00 m2dcs44rnq sshd[15811]: Received disconnect from 2.236.185.188 port 58738:11: Normal Shutdown, Thank you for playing [preauth]
Apr 22 18:48:00 m2dcs44rnq sshd[15811]: Disconnected from 2.236.185.188 port 58738 [preauth]
And of uname -a:
Linux m2dcs44rnq 2.6.32-042stab127.2 #1 SMP Thu Jan 4 16:41:44 MSK 2018 x86_64 x86_64 x86_64 GNU/Linux
I've already tried downloading the package manually and installing it using dkpg, unfortunately, that gave the same error.
After some more research and looking at the logs from journalctl -u docker I found the following line:
Apr 21 18:12:41 m2dcs44rnq dockerd[18728]: time="2018-04-21T18:12:41.088984468-04:00" level=fatal msg="Your Linux kernel version 2.6.32-042stab127.2 is not supported for running docker. Please upgrade your kernel to 3.10.0 or newer."
It turns out my kernel is not supported for Docker. My bad.
In my case, I had kernel version greater than 3.10.0. But seems, the remnants from an older installation was preventing me from installing. So I had to remove, purge and then delete the following before installing again.
/usr/lib/docker/
/etc/docker.service.d/
I'm trying to configure docker exec with systemd service, but it always fail.
The command is working fine when executed directly in the terminal (ssh).
Q: Is that possible to run that way or I need to use inside a bash script (.sh)?
/etc/systemd/system/laravel.service
[Unit]
Description=Laravel Queue
After=docker.service
Requires=docker.service
[Service]
Type=simple
ExecStart="/usr/bin/docker exec -it my_docker /usr/bin/php artisan queue:work --env=production --tries 2 --timeout 60"
User=ubuntu
Group=ubuntu
KillMode=process
Restart=always
[Install]
WantedBy=multi-user.target
sudo service vetspay status
jan 05 03:04:39 legolas systemd[1]: Started Laravel Queue.
jan 05 03:04:39 legolas systemd[1]: laravel.service: Main process exited, code=exited, status=216/GROUP
jan 05 03:04:39 legolas systemd[1]: laravel.service: Unit entered failed state.
jan 05 03:04:39 legolas systemd[1]: laravel.service: Failed with result 'exit-code'.
The error (the input device is not...) is caused by : -it in this line ExecStart="/usr/bin/docker exec -it my_docker /usr/bin/php artisan queue:work --env=production --tries 2 --timeout 60"
User=ubuntu , remove it, it is not necessary when docker exec is in bash file
I tested the command inside a script and got the error: the input device is not a TTY
Basically I cannot use the command with -t because those are non interactive. Removing it now it's working properly!
Where I found the answer:
the input device is not a TTY
I am trying to add docker.service start on linux boot
sudo chkconfig --add docker.service
it gives me this error
error reading information on service docker.service: No such file or directory
I found the answer
sudo systemctl enable docker
I follow the instruction from this site: https://github.com/NVIDIA/nvidia-docker. to install nvidia-docker on the ubuntu 16.04 server. After running the command:
sudo dpkg -i /tmp/nvidia-docker*.deb && rm /tmp/nvidia-docker*.deb
there is error:
$ sudo dpkg -i /tmp/nvidia-docker*.deb && rm /tmp/nvidia-docker*.deb
(Reading database ... 479592 files and directories currently installed.)
Preparing to unpack .../nvidia-docker_1.0.1-1_amd64.deb ...
Unpacking nvidia-docker (1.0.1-1) over (1.0.1-1) ...
dpkg: dependency problems prevent configuration of nvidia-docker:
nvidia-docker depends on docker-engine (>= 1.9.0) | docker-ce | docker-ee; however:
Package docker-engine is not installed.
Package docker-ce is not installed.
Package docker-ee is not installed.
dpkg: error processing package nvidia-docker (--install):
dependency problems - leaving unconfigured
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:
nvidia-docker
$ sudo service docker status
^[[0;1;31m●^[[0m docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: ^[[0;1;31mfailed^[[0m (Result: exit-code) since Tue 2017-04-18 10:05:27 JST; 35s ago
Docs: https://docs.docker.com
Process: 18109 ExecStart=/usr/bin/dockerd -H fd:// ^[[0;1;31m(code=exited, status=1/FAILURE)^[[0m
Main PID: 18109 (code=exited, status=1/FAILURE)
Apr 18 10:05:27 NVIDIA2.cs179idcfcloud.internal systemd[1]: Starting Docker Application Container Engine...
Apr 18 10:05:27 NVIDIA2.cs179idcfcloud.internal dockerd[18109]: Error starting daemon: pid file found, ensure docker is not running or delete
/var/run/docker.pid
Apr 18 10:05:27 NVIDIA2.cs179idcfcloud.internal systemd[1]: ^[[0;1;39mdocker.service: Main process exited, code=exited, status=1/FAILURE^[[0m
Apr 18 10:05:27 NVIDIA2.cs179idcfcloud.internal systemd[1]: ^[[0;1;31mFailed to start Docker Application Container Engine.^[[0m
Apr 18 10:05:27 NVIDIA2.cs179idcfcloud.internal systemd[1]: ^[[0;1;39mdocker.service: Unit entered failed state.^[[0m
Apr 18 10:05:27 NVIDIA2.cs179idcfcloud.internal systemd[1]: ^[[0;1;39mdocker.service: Failed with result 'exit-code'.^[[0m
~$ sudo 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.
how to solve it?
I have solved it. Firstly restart the ubuntu server with linux command(sudo shutdown -r now), and run the command : apt-get -f install(this command is suggested by the error information), then I install the docker-engine by the following site(https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04). then install nvidia-docker, it works!