Docker understanding
Docker Understanding & Quick Commands
Whats Docker? Docker provides the ability to package and run an application in a loosely isolated environment called a container. The isolation and security allows you to run many containers simultaneously on a given host. Docker has some terminology to get familiar with.
We have a few terms to recognize.
- Containers
- Images
- DockerHub
- Dockerfile
What are Docker containers? Containers are lightweight and contain everything needed to run the application, so you do not need to rely on what is currently installed on the host. You can easily share containers while you work, and be sure that everyone you share with gets the same container that works in the same way.
What are Docker images? Docker images are a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.
A container is a runtime instance of a docker image. A container will always run the same, regardless of the infrastructure. Containers isolate software from its environment and ensure that it works uniformly despite differences for instance between development and staging.
Laymans Terms? Lets say you have a wordpress application with plugins and directories full of images and config files in different locations. Using Docker allows you to consolidate all parts of your application into a consolidated environment. This allows you to easily manage the app and its dependancies and move or upgrade the app with ease to get rid of the “it worked on my machine” or “it worked fine on the previous machine” hiccups of yesteryear.
DOCKER HUB
Docker Hub is a service provided by Docker for finding and sharing container images. You can consider it the github of docker. You can find other public docker images and versions through Dockerhub like TeamPasswordManager. Learn more at hub.docker.com
DOCKERFILE
A Dockerfile a text file that contains instructions for building a Docker image. You can consider them config files that follow steps in building a docker image. Read more below on the parameters and setting up a Dockerfile with available commands.
INSTALLATION
Docker Desktop is available for Mac, Linux and Windows https://docs.docker.com/desktop
View example projects that use Docker https://github.com/docker/awesome-compose
Check out our docs for information on using Docker https://docs.docker.com
GENERAL COMMANDS
| Command | description | | ——– | ——- | | docker -d | Start the docker daemon | | docker –help | Get help with Docker. Can also use -help on all subcommands | | docker info | Display system-wide information|
IMAGES
| Command | description |
| ——– | ——- |
| docker build -t
DOCKER HUB
| Command | description |
| ——– | ——- |
| docker login -u
CONTAINERS
| Command | description |
| ——– | ——- |
| docker build -t