Using docker, you can package your enterprise application into one self-contained container, which is guaranteed to run on any environment.
This makes it easy for both developer and sysadmins to manage the application. If you are an administrator, you don’t have to hear this excuse from developer anymore: “But, it works on my dev environment!”
Using Docker Machine, you can install and configure Docker Engine on a remote server. Once docker is installed, from your local machine (laptop), you can remotely manage the docker.
We are going to use Ansible to create user accounts and add users to groups, setup them up with access via ssh using by adding their public keys to authorizedkey files. For the minimum version of this task we are just going to do four things: Create a list of user names; Create a user account for each user name. Sep 26, 2019 You generate an SSH key through macOS by using the Terminal application. Once you upload a valid public SSH key, the Triton Compute Service uses SmartLogin to copy the public key to any new SmartMachine you provision. Joyent recommends RSA keys because the node-manta CLI programs work with RSA keys both locally and with the ssh agent. Create a User. Let's create a new user and then setup some security. New User # login first sudo adduser fideloper # Create password # Skip extra field # Set Y to save the new user # Become new user fideloper sudo su fideloper # Head to home directory cd / # See the file path pwd # /home/ubuntu Setup SSH Key Authentication. We can re-use the. Dec 18, 2019 In this tutorial, we will walk through how to generate SSH keys on Ubuntu 18.04 machines. We will also show you how to set up an SSH key-based authentication and connect to your remote Linux servers without entering a password.
In this tutorial, we’ll specifically talk about the Generic driver used by docker-machine, which will use SSH client to manage the remote docker host.
1. Create dockeradmin user on Remote Host
First, create a Linux user account on the remote server. You don’t really have to use “dockeradmin” as the username, it can be anything. You can even use your own user name.
2. Generate SSH Public-Private Key Pair on Local Host
Next, on your local host (laptop), create a public and private SSH key using ssh-keygen. You should also copy the private key to the remote server.
We explained how to do this in this article: Perform Remote SSH Login Without Password
But, in-short, here is what you need to do for this:
Note: During ssh-keygen, don’t give any passphrase. Leave it empty.
3. Allow Sudo Access for dockeradmin
On your remote server, in the /etc/sudoers file, add the following line, which will give full sudo privilege to dockeradmin account. This means that dockeradmin account can run any root command.
Note: visudo command will modify the /ec/sudoers file. You don’t have to use “vi /etc/sudoers”.
4. Allow External Access on Remote Server
Make sure your remote server can talk to the internet. Counter strike anthology cd key generator. This is required, as the docker-machine command will invoke several yum commands to install certain require packages.
So, just for testing purpose, make sure the following works on your server.
If you don’t have appropriate nameserver setup, modify your /etc/resolve.conf and add the following line. Or, use one of the nameservers provided by your system administrator.
5. docker-machine Generic Driver Command Syntax
When you are using the Generic driver, the following options are available in docker-machine create command.
The following docker-machine syntax shows all the mandatory options:
Generate Ssh Key For Docker User List
In the above syntax:
The following docker-machine syntax shows all available options:
In the above syntax:
6. Create the Remote Docker VM Host
Now, it is time to create the remote docker-vm host using the docker-machine create command.
The following is the same command as above, but I broke it down into multiple line for easy readability.
In the above command:
Note: Again, you’ll be executing the above docker-machine command on your local system. You can use the docker-machine command that came with your Docker Toolbox.
7. Successful docker-machine create Output
If everything worked properly, you’ll see the following output from the docker-machine create command.
Finally, if everything is working properly, you’ll see the remote docker vm host that we created. On your local system, execute the following:
Note: Well, for most part, nothing goes as planned, and you might get some error message. The following are some typical issues that I faced and the solution for those.
8. Error 1: Invalid OS
The current version of docker-machine supports only certain version of OS on the remote server.
For example, if your remote server is running on CentOS 6, you’ll get the following ” /etc/os-release: No such file or directory” error message. This is because for CentOS, it is looking for CentOS 7.
![]() 9. Error 2: Unable to Execute root Command (No Sudo Access)
If you are getting the “Error creating machine: Error running provisioning: exit status 1” error message, after the “Provisioning with centos…” line, then it is not the connection issue. docker-machine was able to connect to the remote server properly.
Generate Ssh Key For Docker User Login
But, in this case, it is unable to execute root command as dockeradmin user. So, use visudo and allow full sudo access to the dockeradmin user as we explained in one of the previous steps.
10. Error 3: netstat command is Missing
If you are getting the “Error running SSH command: exit status 127” error message after the “Setting Docker configuration on the remote daemon…” line, this is also not a connection issue.
![]()
In this case, docker-machine connected to the remote SSH, and it has appropriate sudo access to execute root command, but some of the command it is trying failed, because it is missing “netstat” command.
Microsoft office professional 2010 product key free. To fix this problem, install the net-tools package on the remote server, which contains the “netstat” command.
Generate Ssh Key For Docker User List
I’m hoping in the next version of docker-machine, they’ll probably check whether “netstat” exists on the remote server or not, at the beginning and give appropriate valid error message.
11. Error 4: Docker Client Version Mis-match
If you are getting the following “Error creating machine: Error running provisioning: exit status 1” error message, there is a possibility that the docker client on your local system (laptop) is not matching with the docker client on the remote system.
https://advisorclever806.weebly.com/blog/aws-generate-new-key-pair-form-runing-instance. For example, on local system:
Generate Ssh Key For Docker User Id
On remote server:
In the above example, local docker version is 1.9.1, but the remote docker version is an older 1.8.2. So, here we have a mis-match, and docker-machine create will not work and fail as shown above.
In the above scenario, the docker engine was installed separately on the remote server, which had a different docker client version than the docker client version that came with the docker-machine (docker toolbox) on the local system.
So, in this case, remove the docker from your remote system as shown below.
Now, when you execute the docker-machine command on your local system, it will automatically install the appropriate docker engine and the docker client on the remote server that will be compataible with the docker client on the local machine.
12. Error 5: SELinux or Firewall Blocking Access
By default, the new docker vm machine that we created will be running on TCP port 2376.
On your remote server, make sure you have appropriate firewall rule which will allow TCP port 2376. If you still have problem, just temporarily to rule-out the possibility of firewalld blocking access, stop firewalld and see what happens.
Again, just for debugging purpose, for some reason, if you like to disable the firewalld, you can do it as shown below:
The latest version of Docker works beautifully with SELinux, no issues there. But, in an earlier version of docker, there were some bugs related to docker and SELinux.
Dotnet sn generate public private key pairs. So, if you are facing any issues, try disabling SELinux temporarily and see whether it fixes the issue. To permanently disable SELinux, modify the /etc/selinux/config file accordingly.
Also, note that if SSH is not able to make connection from your local system to the remote server, docker-machine will display the following “Error waiting for SSH: Too many retries waiting for SSH” error message. To fix this, make sure, you implement the SSH password less authentication as explained in one of the above steps.
When all of the above issues are fixed, docker-machine will work without any issues as shown below:
> Add your comment
Docker Ssh TunnelIf you enjoyed this article, you might also like.10.0.5.1 Docker Ssh
Next post: How to Setup CUPS Printer Admin Web GUI for Remote Access
Previous post: How to Setup Vagrant on Linux to Create Virtual Dev Environment
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2020
Categories |