Docker/Basics
(Created page with "Docker Basics") |
|||
Line 1: | Line 1: | ||
[[Docker/Basics|Docker Basics]] | [[Docker/Basics|Docker Basics]] | ||
+ | |||
+ | =Installation= | ||
+ | Installation done on CentOS7. Install, start, enable for system startup. | ||
+ | <nowiki>~$ sudo yum check-update | ||
+ | ~$ curl -fsSL https://get.docker.com/ | sh | ||
+ | ~$ sudo systemctl start docker | ||
+ | ~$ sudo systemctl enable docker</nowiki> | ||
+ | |||
+ | =Images= | ||
+ | ==search== | ||
+ | public Docker Hub (repo) for images of software builds. Includes both official (owner) created and public (consumer) created so be careful with what you download for obvious security reasons. | ||
+ | <nowiki>~$ sudo docker search software_name</nowiki> | ||
+ | ==pull== | ||
+ | download docker images for local deployment. | ||
+ | <nowiki>~$ sudo docker pull software_name</nowiki> | ||
+ | ==list== | ||
+ | get a listing of local available docker images | ||
+ | <nowiki>~$ sudo docker images</nowiki> | ||
+ | ==delete image== | ||
+ | delete a local docker image | ||
+ | <nowiki>~$ sudo docker rmi image_id</nowiki> | ||
+ | ==history== | ||
+ | see a history of the docker image. It is important to know that the history only stacks based on the image_id the container was started up from. If you create multiple changes and commit them separately, the latest image will have all the updates, but will not the multiple comments if they were included in the commit. If you want a consistent linear growth of commit history in the image, you must start the container with the latest image_id before making updates. | ||
+ | <nowiki>~$ sudo docker history image_id</nowiki> | ||
+ | ==commit== | ||
+ | create a new image based on the specified container. It is important to note that if you want to maintain a consistent linear growth of commit history in the image, you must start the container with the latest image_id before making updates or commits.<br> | ||
+ | Also, as best practice it is recommended that you specify the repository where the docker image will be pushed to (whether public or private). Locally however, the repository name structure can be anything, but you should follow best practice to keep organized. | ||
+ | <nowiki>~$ sudo docker commit -m "comment" -a "Author" container_id repository/image_name:tag | ||
+ | ie. ~$ sudo docker commit -m "installed telnet" -a "root" ce056f9a7d2f root_repo/centos-updated:version3</nowiki> |
Revision as of 16:49, 14 June 2018
Docker Basics
Contents |
Installation
Installation done on CentOS7. Install, start, enable for system startup.
~$ sudo yum check-update ~$ curl -fsSL https://get.docker.com/ | sh ~$ sudo systemctl start docker ~$ sudo systemctl enable docker
Images
search
public Docker Hub (repo) for images of software builds. Includes both official (owner) created and public (consumer) created so be careful with what you download for obvious security reasons.
~$ sudo docker search software_name
pull
download docker images for local deployment.
~$ sudo docker pull software_name
list
get a listing of local available docker images
~$ sudo docker images
delete image
delete a local docker image
~$ sudo docker rmi image_id
history
see a history of the docker image. It is important to know that the history only stacks based on the image_id the container was started up from. If you create multiple changes and commit them separately, the latest image will have all the updates, but will not the multiple comments if they were included in the commit. If you want a consistent linear growth of commit history in the image, you must start the container with the latest image_id before making updates.
~$ sudo docker history image_id
commit
create a new image based on the specified container. It is important to note that if you want to maintain a consistent linear growth of commit history in the image, you must start the container with the latest image_id before making updates or commits.
Also, as best practice it is recommended that you specify the repository where the docker image will be pushed to (whether public or private). Locally however, the repository name structure can be anything, but you should follow best practice to keep organized.
~$ sudo docker commit -m "comment" -a "Author" container_id repository/image_name:tag ie. ~$ sudo docker commit -m "installed telnet" -a "root" ce056f9a7d2f root_repo/centos-updated:version3