Docker

Docker network

Check your network When you deploy your docker container with port mapping, the network is automatically generated and the container assigned its own network. atlex@ ~ % docker network ls NETWORK ID NAME DRIVER SCOPEea37d3b97d11 bridge bridge local01573b79ea81 host host local85b9bca4df78 none null local0abac39fbea3 dockerfiletest bridge local`Details atlex@ ~ % docker network inspect dockerfiletest[ { "Name": "dockerfiletest_default", "Id": "0abac39fbea3f9fd55c1bf9ce1288b5623b3905c3ebd2ff9e60393bab8357a24", "Created": "2020-04-15T15:52:24.875480173Z", "Scope": "local", "Driver": "bridge", "EnableIPv6": false, "IPAM": { "Driver": "default", "Options": null, "Config": [ { "Subnet": "172.

Dockerfile

Terminology context: A build’s context is the set of files located in the specified PATH or URL1. Dockerfile sample FROMubuntu:20.04ENV TZ=America/Los_AngelesRUN mkdir -p /home/my_userCOPY ./files/in_home /home/my_user/in_homeARG DEBIAN_FRONTEND=noninteractive RUN apt update && apt upgrade -yRUN apt install -y nginx phpCOPY ./files/nginx/my.conf /etc/nginx/sites-available/my.confRUN ln -s /etc/nginx/sites-available/my.conf /etc/nginx/sites-enabled/my.confCMD ["nginx", "-g", "daemon off;"]Here is the context. . ├── Dockerfile └── files ├── in_home(dir) └── nginx └── my.conf Exec the commands below and run

Docker - intro

Install macOS Environment: macOS 10.15.3 (Intel chip), Mar. 2020. Installing Docker in macOS, the official document seems to recommend installing Docker Desktop with the installer. I don’t need desktop function so far, but this is not so critical when I learn Docker. And it is the easiest way to install Docker CLI in macOS. If you don’t have DockerID, please make it first. Related official Documents: https://docs.docker.com/docker-for-mac/install/ https://hub.