Create a docker image without using an SSH Password

Source: Internet
Author: User

Operating System: VM centos6.5

Container: docker

Prerequisites: you can create an SSH-enabled docker image.


Method 1: manually create


1. generate a new key and public key on the host machine

### Ssh-keygen [-q] [-B bits]-T type [-N new_passphrase] [-C comment] [-foutput_keyfile] # ssh-keygen usage reference official ssh-keygen-Q-n ""-t dsa-F/root /. SSH/id_dsa


2. then place the public key in the created docker container.

ssh -o StrictHostKeyChecking=no [email protected]mkdir -p /root/.sshecho "..." >> /root/.ssh/authorized_keys


3. Test the SSH connection on the host machine

[[email protected]_admin_192.168.240.148_61618_A ~]$ ssh 172.17.0.2 Last login: Sat Aug 2 11:16:10 2014 from 172.17.42.1 [[email protected]_admin_172.17.0.2_22_A ~]$


Method 2: Create a script

The principle is the same. Both generate the key and public key, and then import the key.


This article is from the "O & M Pawn" blog and will not be reposted!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.