Getting Docker to work First Try

So I have an openwrt X86/64 router. I am trying to run a docker container. However I am having two stumbling blocks after installing docker.

Using default tag: latest
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

and when I try to compose:

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 670, in urlopen
  File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 392, in _make_request
  File "/usr/lib/python3.9/http/client.py", line 1285, in request
  File "/usr/lib/python3.9/http/client.py", line 1331, in _send_request
  File "/usr/lib/python3.9/http/client.py", line 1280, in endheaders
  File "/usr/lib/python3.9/http/client.py", line 1040, in _send_output
  File "/usr/lib/python3.9/http/client.py", line 980, in send
  File "/usr/lib/python3.9/site-packages/docker/transport/unixconn.py", line 43, in connect
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
  File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 726, in urlopen
  File "/usr/lib/python3.9/site-packages/urllib3/util/retry.py", line 410, in increment
  File "/usr/lib/python3.9/site-packages/urllib3/packages/six.py", line 734, in reraise
  File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 670, in urlopen
  File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 392, in _make_request
  File "/usr/lib/python3.9/http/client.py", line 1285, in request
  File "/usr/lib/python3.9/http/client.py", line 1331, in _send_request
  File "/usr/lib/python3.9/http/client.py", line 1280, in endheaders
  File "/usr/lib/python3.9/http/client.py", line 1040, in _send_output
  File "/usr/lib/python3.9/http/client.py", line 980, in send
  File "/usr/lib/python3.9/site-packages/docker/transport/unixconn.py", line 43, in connect
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionRefusedError(111, 'Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/docker/api/client.py", line 214, in _retrieve_server_version
  File "/usr/lib/python3.9/site-packages/docker/api/daemon.py", line 181, in version
  File "/usr/lib/python3.9/site-packages/docker/utils/decorators.py", line 46, in inner
  File "/usr/lib/python3.9/site-packages/docker/api/client.py", line 237, in _get
  File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 555, in get
  File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
  File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
  File "/usr/lib/python3.9/site-packages/requests/adapters.py", line 498, in send
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionRefusedError(111, 'Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 33, in <module>
    sys.exit(load_entry_point('docker-compose==1.28.2', 'console_scripts', 'docker-compose')())
  File "/usr/lib/python3.9/site-packages/compose/cli/main.py", line 80, in main
  File "/usr/lib/python3.9/site-packages/compose/cli/main.py", line 189, in perform_command
  File "/usr/lib/python3.9/site-packages/compose/cli/command.py", line 60, in project_from_options
  File "/usr/lib/python3.9/site-packages/compose/cli/command.py", line 152, in get_project
  File "/usr/lib/python3.9/site-packages/compose/cli/docker_client.py", line 41, in get_client
  File "/usr/lib/python3.9/site-packages/compose/cli/docker_client.py", line 170, in docker_client
  File "/usr/lib/python3.9/site-packages/docker/api/client.py", line 197, in __init__
  File "/usr/lib/python3.9/site-packages/docker/api/client.py", line 221, in _retrieve_server_version
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', ConnectionRefusedError(111, 'Connection refused'))

What am I doing wrong?

If docker ps doesn't return anything, you need to start it first with service docker start

service docker start
Usage: service <service> [command]
Service "docker" not found, the following services are available:

and

 opkg install docker
Package docker (20.10.16-1) installed in root is up to date.

and

root@OpenWrt:~# ps -w | grep docker | grep -v docker
root@OpenWrt:~#

opkg update && opkg install dockerd luci-app-dockerman && service dockerd enable && service dockerd start && docker ps

1 Like
root@OpenWrt:~# opkg update && opkg install dockerd luci-app-dockerman && service dockerd enable && service dockerd start && docker ps
Downloading https://downloads.openwrt.org/releases/21.02.3/targets/x86/64/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_core
Downloading https://downloads.openwrt.org/releases/21.02.3/targets/x86/64/packages/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/base/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_base
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/base/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/luci/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_luci
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/luci/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_packages
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/packages/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/routing/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_routing
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/routing/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/telephony/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_telephony
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/telephony/Packages.sig
Signature check passed.
Package dockerd (20.10.16-1) installed in root is up to date.
Package luci-app-dockerman (v0.5.13) installed in root is up to date.
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
root@OpenWrt:~#

here is what happen when I tried reinstall

root@OpenWrt:~# opkg update && opkg install dockerd luci-app-dockerman --force-reinstall --force-overwrite && service dockerd enable && service dockerd start && docker ps
Downloading https://downloads.openwrt.org/releases/21.02.3/targets/x86/64/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_core
Downloading https://downloads.openwrt.org/releases/21.02.3/targets/x86/64/packages/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/base/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_base
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/base/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/luci/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_luci
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/luci/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_packages
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/packages/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/routing/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_routing
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/routing/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/telephony/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_telephony
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/telephony/Packages.sig
Signature check passed.
Removing package dockerd from root...
uci: Parse error (invalid character in name field) at line 1, byte 37
Command failed: Not found
Removing package luci-app-dockerman from root...
Installing dockerd (20.10.16-1) to root...
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/packages/dockerd_20.10.16-1_x86_64.ipk
Installing luci-app-dockerman (v0.5.13) to root...
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/luci/luci-app-dockerman_v0.5.13_all.ipk
Configuring dockerd.
uci: Parse error (invalid character in name field) at line 1, byte 37
Configuring luci-app-dockerman.
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

What is in line 1 of the docker config file?

I am assuming you are talking about the /etc/config/dockerd?

# The following settings require a restart of docker to take full effect, A reload will only have partial or no effect:
# bip
# blocked_interfaces
# extra_iptables_args
# device

config globals 'globals'
#       option alt_config_file '/etc/docker/daemon.json'
        option data_root '/opt/docker/'
        option log_level 'warn'
        option iptables '1'
#       list hosts 'unix:///var/run/docker.sock'
#       option bip '172.18.0.1/24'
#       option fixed_cidr '172.17.0.0/16'
#       option fixed_cidr_v6 'fc00:1::/80'
#       option ipv6 '1'
#       option ip '::ffff:0.0.0.0'
#       list dns '172.17.0.1'
#       list registry_mirrors 'https://<my-docker-mirror-host>'
#       list registry_mirrors 'https://hub.docker.com'

# Docker ignores fw3 rules and by default all external source IPs are allowed to connect to the Docker host.
# See https://docs.docker.com/network/iptables/ for more details.
# firewall config changes are only additive i.e firewall will need to be restarted first to clear old changes,
# then docker restarted to load in new changes.
config firewall 'firewall'
        option device 'docker0'
        list blocked_interfaces 'wan'
#       option extra_iptables_args '--match conntrack ! --ctstate RELATED,ESTABLISHED' # allow outbound connections

which is the default config.

Whatever the issue maybe, it appears to be caused from the dockerd package itself.

I guess it is just not going to work.

I uninstalled and reinstalled separately. I still get the same error when dockerd is installed.

root@OpenWrt:~# opkg update && opkg install docker luci-app-dockerman docker-compose dockerd kmod-macvlan
Downloading https://downloads.openwrt.org/releases/21.02.3/targets/x86/64/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_core
Downloading https://downloads.openwrt.org/releases/21.02.3/targets/x86/64/packages/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/base/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_base
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/base/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/luci/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_luci
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/luci/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_packages
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/packages/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/routing/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_routing
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/routing/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/telephony/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_telephony
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/telephony/Packages.sig
Signature check passed.
Installing docker (20.10.16-1) to root...
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/packages/docker_20.10.16-1_x86_64.ipk
Installing luci-app-dockerman (v0.5.13) to root...
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/luci/luci-app-dockerman_v0.5.13_all.ipk
Installing luci-lib-docker (git-21.167.46325-83f6606) to root...
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/luci/luci-lib-docker_git-21.167.46325-83f6606_all.ipk
Installing docker-compose (1.28.2-1) to root...
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/packages/docker-compose_1.28.2-1_x86_64.ipk
Installing python3-docker (4.4.1-1) to root...
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/packages/python3-docker_4.4.1-1_x86_64.ipk
Installing python3-dockerpty (0.4.1-3) to root...
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/packages/python3-dockerpty_0.4.1-3_x86_64.ipk
Installing dockerd (20.10.16-1) to root...
Downloading https://downloads.openwrt.org/releases/21.02.3/packages/x86_64/packages/dockerd_20.10.16-1_x86_64.ipk
Package kmod-macvlan (5.4.188-1) installed in root is up to date.
Configuring luci-lib-docker.
Configuring docker.
Configuring dockerd.
uci: Parse error (invalid character in name field) at line 1, byte 37
Configuring luci-app-dockerman.
Configuring python3-dockerpty.
Configuring python3-docker.
Configuring docker-compose.
root@OpenWrt:~#

I wish I knew what the problem is.

Edit /etc/config/dockerd and remove line 1, then try to restart the service.

Nice suggestion, but not the solution. What actually worked was

opkg remove docker luci-app-dockerman docker-compose dockerd --autoremove --force-remove

and manual reinstall doing

opkg install docker luci-app-dockerman docker-compose dockerd --force-maintainer

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.