Azure VM with Docker failing to connect - windows

I'm trying to write a Powershell script to create a VM in Azure with Docker installed. From everything I've read, I should be able to do the following:
$image = "b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_3-LTS-amd64-server-20150908-en-us-30GB"
azure vm docker create -e 22 -l 'North Europe' --docker-cert-dir dockercert --vm-size Small <myvmname> $image $userName $password
docker --tls -H tcp://<myvmname>.cloudapp.net:4243 info
The vm creation works, however the docker command fails with the following error:
An error occurred trying to connect: Get https://myvmname.cloudapp.net:4243/v1.20/info: dial tcp 40.127.169.184:4243: ConnectEx tcp: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Some articles I've found refer to port 2376 - but that doesn't work either.
Logging onto Azure portal and viewing the created VM - the Docker VM Extension doesn't seem to have been added and there's no endpoints other than the default SSH one. I was expecting these to have been created by the azure vm docker create command. Although I could be wrong with that bit.
A couple of example article I've looked at are here:
https://azure.microsoft.com/en-gb/documentation/articles/virtual-machines-docker-with-xplat-cli/
http://blog.siliconvalve.com/2015/01/07/get-started-with-docker-on-azure/
However, there's plenty of other articles saying the same thing.
Does anyone know what I'm doing wrong?

I know you are doing nothing wrong. My azurecli-dockerhost connection had been working for months and failed recently. I re-created my docker host using "azure vm docker create" but it does not work any more.
I believe it is a bug that the azure-docker team has to fix.
For the time being, my solution is to:
1) Launch a Ubuntu VM WITHOUT using the Azure docker extension
2) SSH into the VM and install docker with these lines:
sudo su; apt-get -y update
apt-get install linux-image-extra-$(uname -r)
modprobe aufs
curl -sSL https://get.docker.com/ | sh
3) Run docker within this VM directly without relying on a "client" and in particular the azure cli.
If you insist on using the docker client approach, my alternative suggestion would be to update your azure-cli and try 'azure vm docker create' again. Let me know how it goes.
sudo su
apt-get update; apt-get -y install nodejs-legacy; apt-get -y install npm; npm install azure-cli --global

To add an additional answer to my question, it turns out you can do the same using the docker create command ...
docker-machine create $vmname --driver azure --azure-publish-settings-file MySubscription.publishsettings
This method works for me.

Related

Connect to CentOS desktop (GUI) installed on Google cloud

I've installed Centos7 on the Google Cloud Platform, as you know there is just ssh option to connect to the machine.
Now I need to have access to its desktop(GUI) from my laptop (it's win10).
it's appreciated if anyone can help me.
Thanks in advance
you need to ssh login into your CentOS machine either from ssh button in Gcloud, or using the cloud shell:
gcloud compute ssh test-vws
then setup a password for your account:
sudo passwd `whoami`
After that, you will need to install a client that will allow you to navigate the GUI for your server.
again, on your server command line execute:
sudo yum -y update
sudo yum -y groupinstall 'Server with GUI'
once finished, follow this guige to install and setup Teradici Cloud Access Software (Remote Desktop Agent for CentOS).
Installing Teradici Cloud Access Software
On your virtual workstation, install the Teradici repositories:
sudo yum -y install https://downloads.teradici.com/rhel/teradici-repo-latest.noarch.rpm
Install Teradici Standard Agent for Linux:
sudo yum -y update
sudo yum -y install pcoip-agent-standard
Then you will have to register the Agent and create a firewall rule to allow the connection, just follow the guide, and your desktop connection will look like this:

apt-get command not found in coreOS (cos)

I would like to install tools in my cluster VM to debug, like dnsutils or mysql to test connections.
My cluster VM use container optimized OS (cos).
Whenever I try
apt-get update
I got an error
-bash: apt-get: command not found
How could I achieve this ?
As explained here, execute
/usr/bin/toolbox
It will download docker images and login inside once completed, as root user.
You will be able to execute commands like apt-get update / install and debug

Connecting Docker Windows WSL Ubuntu to VMware Ubuntu

I am trying to connect my Windows 10 Home system to be able to run full Linux OS Docker containers. I have installed Docker on both WSL Ubuntu 18.04 as well as a VMware Ubuntu 18.04.
I was trying to follow this guide.
However, I get stuck trying to configure the Daemon as per the instructions.
Can’t use Docker for Windows?
This is only necessary if you are NOT running Docker for Windows!
No problem, just configure your Docker daemon to use -H tcp://0.0.0.0:2375 and --tlsverify=false. Then you can follow along with the rest of this guide exactly.
If you go down this route, I highly recommend rolling your own VM with VMware Player instead of using the Docker Toolbox because VirtualBox has crazy edge case shared folder bugs that will ruin your life at some point. Don’t worry, VMware Player is free. Just Google how to set up Ubuntu 16 server on VMware Player.
When I try to change the Docker Daemon by making a daemon.json file I get errors. I've also tried editing the .profile files and the .bashrc as per other guides (another guide), with no luck.
I am unable to check the DOCKER_HOST variable on the VM Ubuntu.
Don't make things complicated. In your case, why WSL if you just want to connect to a remote daemon? Why not simply use the windows docker client?
Setup you favorite local VM with docker.
Example: I have installed a CentOS distro running on local VMWare Workstation. All Hyper-V of course deinstalled/deactivated.
In this VM, enable tcp access for the daemon.
If you have a systemd linux distro (like mine CentOS), execute this:
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo echo '[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H unix:// -H tcp://0.0.0.0:2375' >> /etc/systemd/system/docker.service.d/options.conf
sudo systemctl daemon-reload
sudo systemctl restart docker`
Test if the port is open with docker info. You should get an API access warning at the bottom result.
Download the Windows docker cli zip from here: https://download.docker.com/win/static/stable/x86_64/
Move the docker.exe to any folder, for ex. your Documents folder.
Then put this folder path into your Windows PATH variable.
Set the docker host: Open PowerShell, execute setx DOCKER_HOST <VM-IP>:2375 and close it.
Open a new PowerShell and call docker info.
You should see the docker and daemon infos.
Do what ever you like now... :-)

Docker initiate the connection to archive.ubuntu

I have managed to install docker into my machine which is using Windows 7. My machine is under corporate network. As i am trying to learn docker i was following this guide. When my Dockerfile is executing:
RUN apt-get -y update && apt-get install -y fortunes
which is perform ubuntu update and installing fortunes i get the following error:
cannot initiate the connection to archive.ubuntu.com:80. and - connect <101:network is unreachable>
In order to solve my problem, first i connected to my vm machine and i located the /etc/resolv.conf file where i modify it to add google dns
namespace 8.8.8.8
but that seems to not solve the issue when i exited and rebuild my Dockerfile.
As my machine is on windows i haven't found a solution for this problem. Does anyone know how should i surpass this problem?
You have to start your dockerd (docker daemon) with same nameserver of your windows computer network settings and then your container and image will get the connectivity from outside network/internet.
For more details Please visit this official link from docker :https://docs.docker.com/docker-for-windows/#network

Installing docker with devstack

I am trying to install devstack and docker (http://devstack.org/guides/single-machine.html) onto a VM containing Ubuntu 13.10 Server. devstack contains a docker installer script in tools/docker/install_docker.sh which it is recommended to run first before running the stack.sh installer script for devstack. I have patched the docker install script according to the bug report https://bugs.launchpad.net/devstack/+bug/1237581 however docker still reports a problem:
socat[NNNN] E connect(3, AF=1 "/var/run/docker.sock", 22): Connection refused
Does anyone know a fix for this problem?
Thanks,
David
If you get error messages regarding /var/run/docker.sock then either the docker daemon/service is not started or your user (devstack user) has no permissions.
Start docker:
service docker restart
Add your user (devstack user) to the docker group. Try to enumerate containers:
docker ps
If that still does not fix the problem then you might want to change the permission of /var/run/docker.sock directly:
sudo chown vagrant:vagrant /var/run/docker.sock
Check your kernel ( uname -a ) and make sure it is 3.8 or latest. Also, make sure you are on a 64bit Ubuntu ( X86_64 distribution ). The point is that the Docker daemon might not be starting (fails) because it is not supported on a 32 bit distribution.

Resources