Docker – New Container

Crate a new Container from Ubuntu Image, in this case…

root@b5855cf66908:/ docker create -t -i ubuntu bash
#output
b5855cf669087ced669bfde4c89175c7f6d062e0e3e31d357a823189e0058044

Get the displayed Container ID after create command

root@b5855cf66908:/ docker start -a -i b5855cf669087ced669bfde4c89175c7f6d062e0e3e31d357a823189e0058044

make your image, how dou you want.. In this case, i will show you ssh-key-copy for auto-deployment.

Update Packages and install openssh-client and create a new key

root@b5855cf66908:/ apt-get update
root@b5855cf66908:/ apt-get install openssh-client -y
root@b5855cf66908:/ ssh-keygen -t rsa -b 4096

end send the id to your production or development server…

root@b5855cf66908:/ ssh-copy-id ssh-deploy@server.com
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'server.com (xx.xxx.xxx)' can't be established.
ECDSA key fingerprint is SHA256:xxxx/xxxx+xx.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
ssh-deploy@server.com's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'ssh-w01a3afb@v1018253.kasserver.com'"
and check to make sure that only the key(s) you wanted were added.

End, exit.

root@b5855cf66908:/ exit

now save the Container changes and give the name.

root@b5855cf66908:/ docker commit b5855cf669087ced669bfde4c89175c7f6d062e0e3e31d357a823189e0058044 customer-ubuntu

Views: 34