Docker – New Container

Visits: 252

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

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

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
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/"
The authenticity of host ' (' 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's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh ''"
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