Containers
Containers are a standard way to package an application and all its dependencies so that it can be moved between environments and run without change. They work by hiding the differences between applications inside the container so that everything outside the container can be standardized.
For example, Docker created standard way to create images for Linux Containers.
Basic Docker Commands
Action | Command |
---|---|
Get Docker version | docker version |
Run hello-world Container |
docker run hello-world |
List Running Containers | docker ps |
Stop a container | docker stop <container-name/container-id> |
List Docker Images | docker images |
Login into registry | docker login |
Build an image | docker build -t <image_name>:<tag> . |
Inspect a docker object | docker inspect <name/id> |
Inspect a docker image | docker inspect image <name/id> |
Pull an image | docker pull <image_name>:<tag> |
Push an Image | docker push <image_name>:<tag> |
Remove a container | docker rm <container-name/container-id> |
Running Docker
-
Install Docker Desktop
-
Test it out
-
Install ibmcloud CLI
-
Verify installation
-
Configure environment. Go to cloud.ibm.com -> click on your profile -> Log into CLI and API and copy IBM Cloud CLI command. It will look something like this:
-
Log into docker through IBM Cloud
Activities
| Task | Description | Link | Time | | ----------------------- | --------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------- | ------ | | | | | IBM Container Registry | Build and Deploy Run using IBM Container Registry | IBM Container Registry | 30 min | | Docker Lab | Running a Sample Application on Docker | Docker Lab | 30 min |
Once you have completed these tasks, you should have a base understanding of containers and how to use Docker.