Working with Docker

Working with Docker

Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. Because all of the containers share the services of a single operating system kernel, they use fewer resources than virtual machines.

  • Install Docker
  • Docker Basic Usage
  • Add Container Images
  • Access to Services on Container
  • Use Docker file
  • Use Persistent Storage
  • Docker Network Basis
Install Docker

Step 1: Run Server Manager and start Add roles and features, then select Containers feature on Select features section like follows to install. After installing, restart computer.

Step 2: Select Role-based or feature-based installation.

Step 3: After restarting, Run PowerShell with Admin Privilege and Install Docker.
Answer Y (Yes) to all confirmations during the installation.

Step 4: After installing, Docker Engine service will be added like follows. Restart computer again.

Step 5: After restarting, Run PowerShell with Admin Privilege and run docker command to verify status.
PS > docker version

Docker Basic Usage

Step 1: Download Windows official image and run [echo] inside a Container.
It’s impossible to run Containers if the Version of Host Windows and Container Windows are not the same one, so specify a specific version when pulling an image. Refer to the official documents below for version compatibility.

⇒ https://docs.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/version-compatibility

Step 2: Connect to the interactive session of a Container with i and t option like follows. If exit from the Container session, the process of a Container finishes.

Step 3: If exit from the Container session with keeping container’s process, push Ctrl+p, and Ctrl+q key.

Add Container Images

Step: For example, Install IIS and add it as a new image for container. The container is generated every time for executing docker run command, so add the latest executed container like follows.

Access to Services on Container

If you’d like to access to services like HTTP or SSH which is running on Containers as a daemon, set like follows.

Step 1: For example, run a container to use the container image which has IIS service like the example of here.

Step 2: Verify the test page is shown normally to access to [localhost:8081] on Parent Host.

Use Dockerfile

Use Dockerfile and create Docker images automatically. It is also useful for configuration management.

Step: For example, Create a Dockerfile to install IIS.

Use Persistent Storage

When Container is removed, data in it are also lost, so it’s necessary to use external filesystem in Containers as persistent storage if you’d like to save data.

Step 1: It’s possible to mount a directory on Docker Host into Containers.

Step 2: It’s also possible to configure external storage by Docker Data Volume command.

Docker Network Basis

This is the basic usage to configure Docker Network.

Step 1: When running containers without specifying network, default [nat] network is assigned.

Step 2: If you’d like to assign another network, set like follows.

Step 3: To remove docker networks, set like follows.

Step 4: To connect to Host network, not nat, set like follows.

Leave a Reply
Your email address will not be published. *

This site uses Akismet to reduce spam. Learn how your comment data is processed.