Using containers is not as intuitive as the tools that we are used to work with. In this section, we will go through Docker usages from the most fundamental ideas to the extent that we are able to benefit from containers.
Container life cycle
Docker basics
When docker run alpine ls is executed, what Docker did behind the scenes is:
- Find the image alpine locally. If not found, Docker will try to find and pull it from the public Docker registry to the local image storage.
- Extract the image and create a container accordingly.
- Execute the entry point defined in the image with commands, which are the arguments after the image name. In this example, it is ls. The entry point by default is /bin/sh -c on the Linux-based Docker.
- When...