I am running 'Docker version 1.10.3, build 20f81dd' on Ubuntu 14.04. Now my requirement is to create/delete/manage new container from the REST API (HTTP) from outside world. So, for this how could I enable Docker to run on a port.
It will be helpful if I get details step as in net I tried few but didn't work.
I found the solution and it's very easy at all. Here is the configuration.
Got To:
vi /etc/default/docker
Add DOCKER_OPTS="-H tcp://127.0.0.1:2375"
restart docker service.
Run netstat -lnp and see docker is running on port 2375
Related
I am currently trying to download Hyperledger Fabric through Ubuntu 20.04. I downloaded ubuntu through the windows store. I have also downloaded docker desktop and set up WSL 2 backend for Ubuntu. However, after installing docker.io through the ubuntu terminal using
sudo apt-get install docker.io
I was trying to enable it. As ubuntu was using Sysvinit instead of systemd i used the following to try and enable docker.
sudo service docker start
which returned
docker: unrecognized service
I am new to linux so any suggestions or anything obvious I have missed that will fix this issue would be appreciated
Thanks
The ubuntu distribution that runs in WSL differs from normal ubuntu in key ways. One of them is that it doesn't have the standard linux initialization system.
service: starts services defined in the SysV init system. If you do ls /etc/init.d/ you will see services. When I look in my WSL installation, I see cron. So this works (but probably doesn't survive a reboot):
sudo service cron start
There is no init script for docker, so that won't work.
systemctl (systemd): starts services defined in the systemd system. This is probably what you want, except, if you run:
sudo systemctl start docker
you get:
System has not been booted with systemd as init system (PID 1). Can't operate.
So, you'll need to start docker manually, not using the normal initialization systems.
This leads us to the real answer:
https://docs.docker.com/docker-for-windows/wsl/
According to the docker docs, you don't run docker as a service on linux. Install docker on windows and let it interact with the docker engine on WSL to run your containers.
For me a simple restart of Windows solved this issue:
I'm using Ubuntu in WSL2 and I'm trying to start a container inside the WSL2, and it gives me this error:
Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:8443 -> 0.0.0.0:0: listen tcp 0.0.0.0:8443: bind: An attempt was made to access a socket in a way forbidden by its access permissions.
My Problem is similar to the other two Questions:starting tutorial and Timeout on windows 2016. But none of it resolved my problem. (on my other search I didn't find any articles that could help my case > search timeout)
For any of the following commands:
docker run hello-world
docker pull hello-world
docker login -u user -p pass
I get the same error:
My proxies are correctly set to my cntlm service:
when I try to get the address with curl I get the following answer:
My docker version:
Docker info:
I've tried all the troubleshoot from this link (create a new default docker machine and so on)
Do you have any idea what could I do to download hello-world (or other) container?
Finally I got it:
First of all the client should be the same Version as the Server (now both are 1.13.1)
Second because I am using a Cntlm I have to create a Tunnel to forward my port from the Cntlm configuration.
ssh -R tunnelPort:proxy-Cntlm docker#ip.docker.machine
where:
tunnelPort will be used on the docker-machine (ex: 3000 for 127.0.0.1:3000)
proxy-Cntlm is the ip + port from cntlm.ini (ex: 127.0.0.1:3128)
ip.docker.machine it can be found simply by running docker-machine ls
One more thing! you have to adjust the ~/.ssh/config (at least for cygwin)
Host docker 192.168.99.100
Hostname 192.168.99.100
IdentityFile "path/to/id_rsa"
#on windows it is C:/Users/user/.docker/machine/machines/default/id_rsa when you have a default Machine
I have installed a repo from docker and ran it using the following command,
docker run -d --name searx -p $PORT:8888 wonderfall/searx
The container was also sucessfully created but while accessing it in my browser i get the following error,
dail tcp[::1]:8888: connectex: No connection could be made because the target machine actively refused it.
Does anyone know why this error occurs? I use a windows10 system.
Just installed docker toolbox
That means you cannot use localhost directly without declaring in Virtual Box a port-forwarding rule.
First, test your service using the IP of your VM (see docker-machine ip default output)
http://<ip>:8888
Then, declare a port-forward rule:
either directly in your VirtualBox graphical interface: see "How do I configure docker compose to expose ports correctly?"
or with VBoxManage controlvm commands: see "Not able to access tomcat application on Docker VM with host(windows) IP while using docker toolbox"
To pass other options to docker build, you can speciy DOCKER_OPTS in /etc/default/docker, however --net is not available. Is it possible to use the host's networking stack when building a container?
I'm running Docker version 1.3.2, build 39fa2fa.
Thanks!
Try --network instead of --net. It is new in the 1.25 API and sets the networking mode for the RUN instructions.
To solve the problem, configure docker daemon to use the your company DNS server. For instance, if your resolv.conf has the following configuration:
$> cat /etc/resolv.conf
domain mycompany
search mycompany
nameserver 10.123.123.123
Change /etc/default/docker to contain the following:
DOCKER_OPTS="--dns 10.123.123.123"
And restart docker daemon with:
sudo service docker restart
Now, containers will have access to the intranet during the build operation.
Related answer: Dockerfile: Docker build can't download packages: centos->yum, debian/ubuntu->apt-get behind intranet
From the newest versions (currently docker ce v17) it is possible to add --network=host to your docker build command which is similar to --net=host when using docker run!
I just installed Docker on mu Ubuntu 14.10 64 bit OS and I followed the steps to create the necessary certificates and keys so that I can secure my docker http remote connections. When I tried to issue the following command,
sudo docker --tlsverify --tlscacert=ca.pem --tlscert=cert.pem --tlskey=key.pem -H=x.x.x.x:2376 version
I get to see the following error message:
Cannot connect to the Docker daemon. Is 'docker -d' running on this host
The -H=x.x.x.x is the host as I see when I did a ifconfig and found the host from the docker0 entry that was listed.
Please help me identify why I'm not able to do anything with my daemon.
Did you change the options on the daemon itself? Paraphrasing the docs:
You can listen on port 2376 on all network interfaces with -H tcp://0.0.0.0:2376, or on a particular network interface using its IP address: -H tcp://192.168.59.103:2376.
To do this you could edit /etc/init/docker.conf and update the DOCKER_OPTS variable
Sometime ago i had this issue :
"Cannot connect to the Docker daemon at tcp://127.0.0.1:2376. Is the docker daemon running?"
Looking an your question, you did not specify if you are working on Ubuntu WSL (Bash).
Regardless of your env configuration.
Looking for the file ".bashrc" in your
add the following to it
export DOCKER_HOST=tcp://192.168.59.103:2376
Happy Devops!