Enable Docker Remote API - raspberry pi / raspbian - docker

My starting point is:
How to use docker remote api to create container?,
so I edit /etc/init/docker.conf and update 2 occurrences of the DOCKER_OPTS variable to:
DOCKER_OPTS='-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock'
Then, a simple test to list docker images fails:
$ service docker restart
$ curl -X GET http://10.143.0.218:4243/images/json
curl: (7) Failed to connect to 10.143.0.218 port 4243: Connection refused
Docker version is:
$ sudo docker version
Client:
Version: 1.12.3
API version: 1.24
Go version: go1.6.3
Git commit: 6b644ec
Built: Wed Oct 26 19:06:36 2016
OS/Arch: linux/arm
Server:
Version: 1.12.3
API version: 1.24
Go version: go1.6.3
Git commit: 6b644ec
Built: Wed Oct 26 19:06:36 2016
OS/Arch: linux/arm

The solution comes from the comments of this page: http://www.virtuallyghetto.com/2014/07/quick-tip-how-to-enable-docker-remote-api.html
[08/18/2016 at 6:00 am] Oliver Weise says:
Thanks, that put me in the right direction. However since Ubuntu 16.04
with its systemd docker daemon the /etc/default/docker is no longer
effective. Instead you need to create a systemd dropin file.
I placed such a file under: /etc/systemd/system/docker.service.d/remote-api.conf
With the contents:
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H tcp://127.0.0.1:2376 -H unix:///var/run/docker.sock
(Yes, the double ExecStart is necessary)
After that run:
sudo systemctl daemon-reload // reloading daemon definitions
sudo systemctl restart docker

Not tested this, but if it's Jessie, then it uses systemd by default as the init system iirc, and this has implications for how the daemon (dockerd) is configured and started.
So you're editing the /etc/init/docker.conf file but I don't think that's being read / used.
Take a read of this article on different startup procedures on each init system in Docker, and this for specific systemd configuration.

Related

Metabase on docker not getting exposed

I'm having some trouble trying to get metabase running on docker.
I've installed Docker for Windows 7 following this tutotial.
Here is the docker version:
Client:
Version: 18.03.0-ce
API version: 1.37
Go version: go1.9.4
Git commit: 0520e24302
Built: Fri Mar 23 08:31:36 2018
OS/Arch: windows/amd64
Experimental: false
Orchestrator: swarm
Server:
Engine:
Version: 18.05.0-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.10.1
Git commit: f150324
Built: Wed May 9 22:20:42 2018
OS/Arch: linux/amd64
Experimental: false
Now when I try to get the metabase running on docker, using
docker run -d -p 3000:3000 --name metabase metabase/metabase
and using
docker logs -f metabase
I get the message after all the setup:
Metabase Initialization COMPLETE
The problem is when I try to access http://0.0.0.0:3000 I get a ERR_ADDRESS_INVALID. I looked for all the ports that are "LISTENING" using
netstat -aon | find /i "listening"
I don't see the 0.0.0.0:3000 listed there.
Docker ps returns:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6a283cf6b8d7 metabase/metabase "/app/run_metabase.sh" 4 hours ago Up 4 hours 0.0.0.0:3000->3000/tcp metabase
I'm not sure if this is a problem with metabase image or with docker itself.
Does anyone have an idea on what this could be?
This 0.0.0.0 is not a valid IP address, but a non-routable meta-address
Your application is reachable on your machines IP address / hostname on port 3000.
If you are unsure, what your hostname is, you can run in powershell;
hostname
And then access it using http://your_hostname:3000

Error with Docker daemon for docker installation on Fiware cloud

I am new with the Fiware and docker technologies so I need some help.
I am following the instructions from this link http://simple-docker-hosting-on-fiware-cloud.readthedocs.io/en/v1.0/manuals/install in order to create a docker-host machine on Fiware cloud but when I run the following command:
docker-machine create -d openstack --openstack-flavor-id="2" --openstack-image-name="base_ubuntu_14.04" --openstack-net-name="node-int-net-01" --openstack-floatingip-pool="public-ext-net-01" --openstack-sec-groups="docker-sg" --openstack-ssh-user "ubuntu" docker-host
I receive the following error:
Error creating machine: Error running provisioning: Unable to verify the Docker daemon is listening: Maximum number of retries (10) exceeded
Although, I can see the instance of the docker-host machine on Fiware cloud, but when I run the following command:
eval "$(docker-machine env docker-host)"
the following error comes up:
Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "147.27.60.136:2376": dial tcp 147.27.60.136:2376: connectex: No connection could be made because the target machine actively refused it.
You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'.
Be advised that this will trigger a Docker daemon restart which might stop running containers.**
I also tried to regenerate the certificates:
docker-machine regenerate-certs docker-host
but I received the following error:
Error getting SSH command to check if the daemon is up: ssh command error:
command : sudo docker version
err : exit status 1
output : Client:
Version: 18.04.0-ce
API version: 1.37
Go version: go1.9.4
Git commit: 3d479c0
Built: Tue Apr 10 18:21:14 2018
OS/Arch: linux/amd64
Experimental: false
Orchestrator: swarm
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?**
Image with the result for the Command: docker-machine ls
What am I doing wrong?
I use docker community edition for windows 10.
The docker version is:
Client:
Version: 18.03.0-ce
API version: 1.37
Go version: go1.9.4
Git commit: 0520e24
Built: Wed Mar 21 23:06:28 2018
OS/Arch: windows/amd64
Experimental: false
Orchestrator: swarm
Server:
Version: 18.03.0-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.9.4
Git commit: 0520e24
Built: Wed Mar 21 23:14:32 2018
OS/Arch: linux/amd64
Experimental: false
First make sure you've opened your docker port (tcp/2376) in your default security group
Let me suggest you using base_ubuntu_16.04 instead of base_ubuntu_14.04
Anyway, it won't run properly at first. There is a problem with the latests versions of docker and docker-machine. As a workaround, after running your docker-machine command, you can do this to fix the problem:
ssh docker-host 'sudo apt-get -y install linux-image-extra-$(uname -r) linux-image-extra-virtual ; sudo modprobe aufs ; sudo service docker start'
However, you might find furhter problems due to MTU configuration in your docker host. To solve them, you can lower your MTU with these commands:
docker-machine ssh docker-host "sudo sed -i 's/--label provider=openstack/--label provider=openstack\n--mtu=1400/g' /etc/default/docker"
docker-machine ssh docker-host "sudo service docker restart"
docker-machine ssh docker-host "sudo ip link set mtu 1400 dev docker0"

Error on create new generic docker machine

I trying to create new docker-machine with driver "generic" on VPS and I get this error:
MacBook-Pro-Pavel:demo pavel$ docker-machine create --driver generic --generic-ssh-key ~/.ssh/id_rsa --generic-ip-address=5.63.154.209 regru
Running pre-create checks...
Creating machine...
(regru) Importing SSH key...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with debian...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Error creating machine: Error running provisioning: ssh command error:
command : sudo systemctl -f start docker
err : exit status 1
output : Job for docker.service failed. See 'systemctl status docker.service' and 'journalctl -xn' for details.
Machine with driver "virtualbox" create normally:
MacBook-Pro-Pavel:~ pavel$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
regru - generic Running tcp://5.63.154.209:2376 Unknown Unable to query docker version: Cannot connect to the docker engine endpoint
swarm-node-0 - virtualbox Running tcp://192.168.99.100:2376 v17.06.0-ce
swarm-node-1 - virtualbox Running tcp://192.168.99.101:2376 v17.06.0-ce
systemctl status docker.service и journalctl -xn here.
What am I doing wrong?
UPDATE
$ docker version
Client:
Version: 17.06.0-ce
API version: 1.30
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:31:53 2017
OS/Arch: darwin/amd64
Server:
Version: 17.06.0-ce
API version: 1.30 (minimum version 1.12)
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:51:55 2017
OS/Arch: linux/amd64
Experimental: true
Chances are, you are doing everything right.
It seems there is an issue with docker.
I don't have much understanding, however here is a link for details:
https://forums.docker.com/t/docker-machine-create-fails-on-digitalocean/34750
Work around is to manually provide older docker engine:
docker-machine create
--driver amazonec2
--engine-install-url=https://web.archive.org/web/20170623081500/https://get.docker.com
Add --engine-install-url to your setup and see if that works.

Docker Compose (docker-compose) couldn't connect to docker daemon on Windows Server 2016 TP5

I am trying to get docker-compose to work on Windows Server 2016 TP5. I have installed Docker Desktop for Windows (not Docker Toolbox) as a service, which works perfectly. I have downloaded the latest docker-compose for windows from https://dl.bintray.com/docker-compose/master/ and put it in the same path as Docker (after unblocking the downloaded file, and renaming it to docker-compose.exe.
When I run the docker-compose up (in Powershell as an Administrator), I get the following error:
ERROR: Couldn't connect to Docker daemon. You might need to install
Docker:
https://docs.docker.com/engine/installation/
Here are the docker and docker-compose information on my machine:
Docker:
Client:
Version: 1.12.1
API version: 1.24
Go version: go1.6.3
Git commit: 23cf638
Built: Thu Aug 18 17:52:38 2016
OS/Arch: windows/amd64
Server:
Version: 1.12.1
API version: 1.24
Go version: go1.6.3
Git commit: 23cf638
Built: Thu Aug 18 17:52:38 2016
OS/Arch: windows/amd64
Docker Compose:
docker-compose version 1.9.0dev, build f65f89a
You might want to try to set your DOCKER_HOST:
$ENV:DOCKER_HOST="npipe://\\.\pipe\docker_engine"
Alternatively, when registering the engine, you can make it listen on TCP too:
dockerd.exe -H npipe:////./pipe/docker_engine -H localhost:2375 --register-service
There are more details on this Compose issue

Certificate error in docker

I'm behind a corporate firewall and have installed Docker on an Ubuntu 14.04 LTS server. Following instructions at http://docs.docker.com/linux/step_one/.
Things seemed to be OK:-
$ docker version
Client:
Version: 1.9.1
API version: 1.21
Go version: go1.4.2
Git commit: a34a1d5
Built: Fri Nov 20 13:12:04 UTC 2015
OS/Arch: linux/amd64
Server:
Version: 1.9.1
API version: 1.21
Go version: go1.4.2
Git commit: a34a1d5
Built: Fri Nov 20 13:12:04 UTC 2015
OS/Arch: linux/amd64
... but I can't pull and run any images. Example:-
$ docker run hello-world
gives:
Error while pulling image: Get
https://index.docker.io/v1/repositories/library/hello-world/images:
x509: certificate is valid for FG3K6C3A15800002, not index.docker.io
Have spent ages searching around - I don't understand what the issue is - I've set http_proxy and https_proxy env vars but not sure what to try next. The docs don't mention any certificate requirements.
Any help appreciated!
The problem may be the proxy. If you are using a proxy to access the internet, you have to change the file /etc/default/docker and put your proxy on it.
export http_proxy="http://proxy_ip:proxy_port"
export https_proxy="http://proxy_ip:proxy_port"
After do it, restart the service:
sudo service docker restart
It works to me.
Hey Pravins I have the same issue, with my docker 1.11.2 It seems is not taken proxy settings from /etc/default/docker and from env neighter.
So what I did was what it says here
http://docs.master.dockerproject.org/engine/admin/systemd/#http-proxy
Many Linux distributions use systemd to start the Docker daemon.
You need check if the docker.service uses an EnvironmentFile, and/or You can customize the Docker daemon options using override files as explained in the HTTP Proxy example below.

Resources