avatarMB20261

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

27083

Abstract

                                            <span class="hljs-number">0</span>.0s

=> => transferring <span class="hljs-symbol">context:</span> 32B <span class="hljs-number">0</span>.0s => [<span class="hljs-number">1</span>/<span class="hljs-number">2</span>] <span class="hljs-variable constant_">FROM</span> docker.io/library/<span class="hljs-symbol">nginx:</span>alpine<span class="hljs-variable">@sha256</span><span class="hljs-symbol">:c94a22b036afa972426b82d5b0a49c959786005b4f6f81ac7467ca5538d0</span> <span class="hljs-number">0</span>.0s => <span class="hljs-variable constant_">CACHED</span> [<span class="hljs-number">2</span>/<span class="hljs-number">2</span>] <span class="hljs-variable constant_">COPY</span> index.html /usr/share/nginx/html/ <span class="hljs-number">0</span>.0s => exporting to image <span class="hljs-number">0</span>.0s => => exporting layers <span class="hljs-number">0</span>.0s => => writing image <span class="hljs-symbol">sha256:</span>dd205ee3afc7ae27ad1f5d669612f5a9e3f44dc6e6a825be0b6f4830871ca3be <span class="hljs-number">0</span>.0s => => naming to docker.io/mbtmp/docker-introduction <span class="hljs-number">0</span>.0s

<span class="hljs-symbol">C:</span><span class="hljs-title class_">LocalFolder</span>\temp\myimage1></pre></div><p id="bcdf">Let’s test the image locally. This time, we map the port to 8081.</p><div id="d527"><pre>C:\LocalFolder\temp\myimage1>docker images REPOSITORY TAG IMAGE ID CREATED SIZE myweb latest dd205ee3afc7 35 minutes ago 41MB mbtmp/docker-introduction latest dd205ee3afc7 35 minutes ago 41MB httpd latest 192d41583429 11 days ago 145MB docker/getting-started latest 3e4394f6b72f 3 months ago 47MB

C:\LocalFolder\temp\myimage1>docker run -d -p 8081:80 mbtmp/docker-introduction aab1b984578b803acc5011b0219cc3b80d56e26d03a0876822725e5468d815dd

C:\LocalFolder\temp\myimage1>docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES aab1b984578b mbtmp/docker-introduction <span class="hljs-string">"/docker-entrypoint.…"</span> 6 seconds ago Up 4 seconds 0.0.0.0:8081->80/tcp eloquent_sammet 56238eab4830 myweb <span class="hljs-string">"/docker-entrypoint.…"</span> 32 minutes ago Up 32 minutes 0.0.0.0:8080->80/tcp suspicious_hertz

C:\LocalFolder\temp\myimage1></pre></div><figure id="294d"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*tmMyFi5l_pkjNjNbMpiwcA.png"><figcaption></figcaption></figure><p id="2919">Everything looks good, let’s publish (push) to DockerHub.</p><div id="1596"><pre><span class="hljs-symbol">C:</span>\LocalFolder\temp\myimage1>docker push mbtmp/docker-introduction <span class="hljs-keyword">Using</span> <span class="hljs-keyword">default</span> tag: latest The push refers <span class="hljs-keyword">to</span> repository [docker.io/mbtmp/docker-introduction] <span class="hljs-number">0</span>f239a39b256: Pushed <span class="hljs-number">31531248</span>c7cb: Mounted <span class="hljs-keyword">from</span> library/nginx <span class="hljs-symbol">f9cb3f1f1d3d:</span> Mounted <span class="hljs-keyword">from</span> library/nginx <span class="hljs-symbol">f0fb842dea41:</span> Mounted <span class="hljs-keyword">from</span> library/nginx <span class="hljs-symbol">c1cd5c8c68ef:</span> Mounted <span class="hljs-keyword">from</span> library/nginx <span class="hljs-number">1</span>d54586a1706: Mounted <span class="hljs-keyword">from</span> library/nginx <span class="hljs-number">1003</span>ff723696: Mounted <span class="hljs-keyword">from</span> library/nginx <span class="hljs-symbol">f1417ff83b31:</span> Mounted <span class="hljs-keyword">from</span> library/nginx <span class="hljs-symbol">latest:</span> digest: sha256:c421138f606127bee3dd817aa958f86f0e71f1bfff0847737397d5346cd3ffcc size: <span class="hljs-number">1988</span>

<span class="hljs-symbol">C:</span>\LocalFolder\temp\myimage1></pre></div><p id="578c">Now, go to DockerHub to check the image just published.</p><figure id="18b0"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*pNt3JHFPbrmg-4LLbzS3cA.png"><figcaption></figcaption></figure><p id="632b">Last, let’s clean up all local images and containers, and pull your image from DockerHub then execute it.</p><div id="250f"><pre><span class="hljs-section">C:\LocalFolder\temp\myimage1>docker run -d -p 8082:80 mbtmp/docker-introduction</span> Unable to find image 'mbtmp/docker-introduction:latest' locally <span class="hljs-section">latest: Pulling from mbtmp/docker-introduction</span> <span class="hljs-section">f56be85fc22e: Already exists</span> <span class="hljs-section">2ce963c369bc: Already exists</span> <span class="hljs-section">59b9d2200e63: Already exists</span> <span class="hljs-section">3e1e579c95fe: Already exists</span> <span class="hljs-section">547a97583f72: Already exists</span> <span class="hljs-section">1f21f983520d: Already exists</span> <span class="hljs-section">c23b4f8cf279: Already exists</span> <span class="hljs-section">98ec662e4cb1: Already exists</span> <span class="hljs-section">Digest: sha256:c421138f606127bee3dd817aa958f86f0e71f1bfff0847737397d5346cd3ffcc</span> <span class="hljs-section">Status: Downloaded newer image for mbtmp/docker-introduction:latest</span> ffdaf619a7a135a63e733825469ecae17c4b75de573e594138beaeb3458ae8d4

<span class="hljs-section">C:\LocalFolder\temp\myimage1></span></pre></div><h1 id="342c">Common Docker Commands</h1><p id="f044">Now, let’s play the most common docker commands. For full references of all docker commands, please refer to <a href="https://docs.docker.com/engine/reference/commandline/cli/">official website</a>.</p><p id="87d1"><b>Docker version and Docker info:</b></p><div id="fbea"><pre><span class="hljs-string">C:\LocalFolder>docker</span> <span class="hljs-string">version</span> <span class="hljs-attr">Client:</span> <span class="hljs-attr">Cloud integration:</span> <span class="hljs-string">v1.0.31</span> <span class="hljs-attr">Version:</span> <span class="hljs-number">20.10</span><span class="hljs-number">.23</span> <span class="hljs-attr">API version:</span> <span class="hljs-number">1.41</span> <span class="hljs-attr">Go version:</span> <span class="hljs-string">go1.18.10</span> <span class="hljs-attr">Git commit:</span> <span class="hljs-number">7155243</span> <span class="hljs-attr">Built:</span> <span class="hljs-string">Thu</span> <span class="hljs-string">Jan</span> <span class="hljs-number">19</span> <span class="hljs-number">17</span><span class="hljs-string">:43:10</span> <span class="hljs-number">2023</span> <span class="hljs-attr">OS/Arch:</span> <span class="hljs-string">windows/amd64</span> <span class="hljs-attr">Context:</span> <span class="hljs-string">default</span> <span class="hljs-attr">Experimental:</span> <span class="hljs-literal">true</span>

<span class="hljs-attr">Server:</span> <span class="hljs-string">Docker</span> <span class="hljs-string">Desktop</span> <span class="hljs-number">4.17</span><span class="hljs-number">.1</span> <span class="hljs-string">(101757)</span> <span class="hljs-attr">Engine:</span> <span class="hljs-attr">Version:</span> <span class="hljs-number">20.10</span><span class="hljs-number">.23</span> <span class="hljs-attr">API version:</span> <span class="hljs-number">1.41</span> <span class="hljs-string">(minimum</span> <span class="hljs-string">version</span> <span class="hljs-number">1.12</span><span class="hljs-string">)</span> <span class="hljs-attr">Go version:</span> <span class="hljs-string">go1.18.10</span> <span class="hljs-attr">Git commit:</span> <span class="hljs-string">6051f14</span> <span class="hljs-attr">Built:</span> <span class="hljs-string">Thu</span> <span class="hljs-string">Jan</span> <span class="hljs-number">19</span> <span class="hljs-number">17</span><span class="hljs-string">:32:04</span> <span class="hljs-number">2023</span> <span class="hljs-attr">OS/Arch:</span> <span class="hljs-string">linux/amd64</span> <span class="hljs-attr">Experimental:</span> <span class="hljs-literal">false</span> <span class="hljs-attr">containerd:</span> <span class="hljs-attr">Version:</span> <span class="hljs-number">1.6</span><span class="hljs-number">.18</span> <span class="hljs-attr">GitCommit:</span> <span class="hljs-string">2456e983eb9e37e47538f59ea18f2043c9a73640</span> <span class="hljs-attr">runc:</span> <span class="hljs-attr">Version:</span> <span class="hljs-number">1.1</span><span class="hljs-number">.4</span> <span class="hljs-attr">GitCommit:</span> <span class="hljs-string">v1.1.4-0-g5fd4c4d</span> <span class="hljs-attr">docker-init:</span> <span class="hljs-attr">Version:</span> <span class="hljs-number">0.19</span><span class="hljs-number">.0</span> <span class="hljs-attr">GitCommit:</span> <span class="hljs-string">de40ad0</span>

<span class="hljs-string">C:\LocalFolder>docker</span> <span class="hljs-string">info</span> <span class="hljs-attr">Client:</span> <span class="hljs-attr">Context:</span> <span class="hljs-string">default</span> <span class="hljs-attr">Debug Mode:</span> <span class="hljs-literal">false</span> <span class="hljs-attr">Plugins:</span> <span class="hljs-attr">buildx:</span> <span class="hljs-string">Docker</span> <span class="hljs-string">Buildx</span> <span class="hljs-string">(Docker</span> <span class="hljs-string">Inc.,</span> <span class="hljs-string">v0.10.3)</span> <span class="hljs-attr">compose:</span> <span class="hljs-string">Docker</span> <span class="hljs-string">Compose</span> <span class="hljs-string">(Docker</span> <span class="hljs-string">Inc.,</span> <span class="hljs-string">v2.15.1)</span> <span class="hljs-attr">dev:</span> <span class="hljs-string">Docker</span> <span class="hljs-string">Dev</span> <span class="hljs-string">Environments</span> <span class="hljs-string">(Docker</span> <span class="hljs-string">Inc.,</span> <span class="hljs-string">v0.1.0)</span> <span class="hljs-attr">extension:</span> <span class="hljs-string">Manages</span> <span class="hljs-string">Docker</span> <span class="hljs-string">extensions</span> <span class="hljs-string">(Docker</span> <span class="hljs-string">Inc.,</span> <span class="hljs-string">v0.2.18)</span> <span class="hljs-attr">sbom:</span> <span class="hljs-string">View</span> <span class="hljs-string">the</span> <span class="hljs-string">packaged-based</span> <span class="hljs-string">Software</span> <span class="hljs-string">Bill</span> <span class="hljs-string">Of</span> <span class="hljs-string">Materials</span> <span class="hljs-string">(SBOM)</span> <span class="hljs-string">for</span> <span class="hljs-string">an</span> <span class="hljs-string">image</span> <span class="hljs-string">(Anchore</span> <span class="hljs-string">Inc.,</span> <span class="hljs-number">0.6</span><span class="hljs-number">.0</span><span class="hljs-string">)</span> <span class="hljs-attr">scan:</span> <span class="hljs-string">Docker</span> <span class="hljs-string">Scan</span> <span class="hljs-string">(Docker</span> <span class="hljs-string">Inc.,</span> <span class="hljs-string">v0.25.0)</span> <span class="hljs-attr">scout:</span> <span class="hljs-string">Command</span> <span class="hljs-string">line</span> <span class="hljs-string">tool</span> <span class="hljs-string">for</span> <span class="hljs-string">Docker</span> <span class="hljs-string">Scout</span> <span class="hljs-string">(Docker</span> <span class="hljs-string">Inc.,</span> <span class="hljs-string">v0.6.0)</span>

<span class="hljs-attr">Server:</span> <span class="hljs-attr">Containers:</span> <span class="hljs-number">1</span> <span class="hljs-attr">Running:</span> <span class="hljs-number">0</span> <span class="hljs-attr">Paused:</span> <span class="hljs-number">0</span> <span class="hljs-attr">Stopped:</span> <span class="hljs-number">1</span> <span class="hljs-attr">Images:</span> <span class="hljs-number">2</span> <span class="hljs-attr">Server Version:</span> <span class="hljs-number">20.10</span><span class="hljs-number">.23</span> <span class="hljs-attr">Storage Driver:</span> <span class="hljs-string">overlay2</span> <span class="hljs-attr">Backing Filesystem:</span> <span class="hljs-string">extfs</span> <span class="hljs-attr">Supports d_type:</span> <span class="hljs-literal">true</span> <span class="hljs-attr">Native Overlay Diff:</span> <span class="hljs-literal">true</span> <span class="hljs-attr">userxattr:</span> <span class="hljs-literal">false</span> <span class="hljs-attr">Logging Driver:</span> <span class="hljs-string">json-file</span> <span class="hljs-attr">Cgroup Driver:</span> <span class="hljs-string">cgroupfs</span> <span class="hljs-attr">Cgroup Version:</span> <span class="hljs-number">2</span> <span class="hljs-attr">Plugins:</span> <span class="hljs-attr">Volume:</span> <span class="hljs-string">local</span> <span class="hljs-attr">Network:</span> <span class="hljs-string">bridge</span> <span class="hljs-string">host</span> <span class="hljs-string">ipvlan</span> <span class="hljs-string">macvlan</span> <span class="hljs-literal">null</span> <span class="hljs-string">overlay</span> <span class="hljs-attr">Log:</span> <span class="hljs-string">awslogs</span> <span class="hljs-string">fluentd</span> <span class="hljs-string">gcplogs</span> <span class="hljs-string">gelf</span> <span class="hljs-string">journald</span> <span class="hljs-string">json-file</span> <span class="hljs-string">local</span> <span class="hljs-string">logentries</span> <span class="hljs-string">splunk</span> <span class="hljs-string">syslog</span> <span class="hljs-attr">Swarm:</span> <span class="hljs-string">inactive</span> <span class="hljs-attr">Runtimes:</span> <span class="hljs-string">io.containerd.runtime.v1.linux</span> <span class="hljs-string">runc</span> <span class="hljs-string">io.containerd.runc.v2</span> <span class="hljs-attr">Default Runtime:</span> <span class="hljs-string">runc</span> <span class="hljs-attr">Init Binary:</span> <span class="hljs-string">docker-init</span> <span class="hljs-attr">containerd version:</span> <span class="hljs-string">2456e983eb9e37e47538f59ea18f2043c9a73640</span> <span class="hljs-attr">runc version:</span> <span class="hljs-string">v1.1.4-0-g5fd4c4d</span> <span class="hljs-attr">init version:</span> <span class="hljs-string">de40ad0</span> <span class="hljs-attr">Security Options:</span> <span class="hljs-string">seccomp</span> <span class="hljs-attr">Profile:</span> <span class="hljs-string">default</span> <span class="hljs-string">cgroupns</span> <span class="hljs-attr">Kernel Version:</span> <span class="hljs-number">5.15</span><span class="hljs-number">.90</span><span class="hljs-number">.1</span><span class="hljs-string">-microsoft-standard-WSL2</span> <span class="hljs-attr">Operating System:</span> <span class="hljs-string">Docker</span> <span class="hljs-string">Desktop</span> <span class="hljs-attr">OSType:</span> <span class="hljs-string">linux</span> <span class="hljs-attr">Architecture:</span> <span class="hljs-string">x86_64</span> <span class="hljs-attr">CPUs:</span> <span class="hljs-number">12</span> <span class="hljs-attr">Total Memory:</span> <span class="hljs-number">15.</span><span class="hljs-string">54GiB</span> <span class="hljs-attr">Name:</span> <span class="hljs-string">docker-desktop</span> <span class="hljs-attr">ID:</span> <span class="hljs-string">GFFK:5WLD:YAFM:ZL2V:EJI7:RPWI:RWVM:ANBA:X7HY:YK3N:RTVV:FLLT</span> <span class="hljs-attr">Docker Root Dir:</span> <span class="hljs-string">/var/lib/docker</span> <span class="hljs-attr">Debug Mode:</span> <span class="hljs-literal">false</span> <span class="hljs-attr">HTTP Proxy:</span> <span class="hljs-string">http.docker.internal:3128</span> <span class="hljs-attr">HTTPS Proxy:</span> <span class="hljs-string">http.docker.internal:3128</span> <span class="hljs-attr">No Proxy:</span> <span class="hljs-string">hubproxy.docker.internal</span> <span class="hljs-attr">Registry:</span> <span class="hljs-string">https://index.docker.io/v1/</span> <span class="hljs-attr">Labels:</span> <span class="hljs-attr">Experimental:</span> <span class="hljs-literal">false</span> <span class="hljs-attr">Insecure Registries:</span> <span class="hljs-string">hubproxy.docker.internal:5555</span> <span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.0</span><span class="hljs-string">/8</span> <span class="hljs-attr">Live Restore Enabled:</span> <span class="hljs-literal">false</span>

<span class="hljs-string">C:\LocalFolder>C:\LocalFolder></span></pre></div><p id="2867"><b>Download images (pull, from <a href="https://hub.docker.com">DockerHub </a>by default), list downloaded images, and delete downloaded images:</b></p><div id="fbe1"><pre><span class="hljs-symbol">C:</span>\LocalFolder>docker pull httpd <span class="hljs-keyword">Using</span> <span class="hljs-keyword">default</span> tag: latest <span class="hljs-symbol">latest:</span> Pulling <span class="hljs-keyword">from</span> library/httpd <span class="hljs-symbol">f1f26f570256:</span> Pull complete <span class="hljs-symbol">a6b093ae1967:</span> Pull complete <span class="hljs-number">6</span>b400bbb27df: Pull complete <span class="hljs-symbol">d9833ead928a:</span> Pull complete <span class="hljs-symbol">ace056404ed3:</span> Pull complete <span class="hljs-symbol">Digest:</span> sha256:f3e9eb9acace5bbc13c924293d2247a65bb59b8f062bcd98cd87ee4e18f86733 <span class="hljs-symbol">Status:</span> Downloaded newer image <span class="hljs-keyword">for</span> httpd:latest docker.io/library/httpd:latest

<span class="hljs-symbol">C:</span>\LocalFolder>docker images REPOSITORY TAG IMAGE ID CREATED SIZE httpd latest <span class="hljs-number">192</span>d41583429 <span class="hljs-number">11</span> days ago <span class="hljs-number">145</span>MB docker/getting-started latest <span class="hljs-number">3e4394f</span>6b72f <span class="hljs-number">3</span> months ago <span class="hljs-number">47</span>MB

<span class="hljs-symbol">C:</span>\LocalFolder>docker image rm httpd <span class="hljs-symbol">Untagged:</span> httpd:latest <span class="hljs-symbol">Untagged:</span> httpd@sha256:f3e9eb9acace5bbc13c924293d2247a65bb59b8f062bcd98cd87ee4e18f86733 <span class="hljs-symbol">Deleted:</span> sha256:<span class="hljs-number">192</span>d41583429c96af40eb3af02d4baaf6398c178e832c114abe030ff986ee826 <span class="hljs-symbol">Deleted:</span> sha256:<span class="hljs-number">02</span>cfaead37b294d643f4d491e109405b87c6771dab37869e2df8c69f9be45b99 <span class="hljs-symbol">Deleted:</span> sha256:<span class="hljs-number">6</span>f8156ee44091069a7feb88bf3dfe12e9e2c7a161ecd34d11a50af1336359eff <span class="hljs-symbol">Deleted:</span> sha256:<span class="hljs-number">19</span>ebb8bacf71ef69d0b854e3640aff8f7e36698837eca9d17b3c84787a369b1f <span class="hljs-symbol">Deleted:</span> sha256:af68c6e8ab5b3e93e58afcc42569ef9fa784b28d017689fd086a03a54ad21ebd <span class="hljs-symbol">Deleted:</span> sha256:<span class="hljs-number">3</span>af14c9a24c941c626553628cf1942dcd94d40729777f2fcfbcd3b8a3dfccdd6

<span class="hljs-symbol">C:</span>\LocalFolder>docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker/getting-started latest <span class="hljs-number">3e4394f</span>6b72f <span class="hljs-number">3</span> months ago <span class="hljs-number">47</span>MB

<span class="hljs-symbol">C:</span>\LocalFolder></pre></div><p id="fa8d"><b>Start a docker instance from image (if not in local, will pull from DockerHub), find running instances, stop running instances. </b>Note, you could run multiple instances from the same image.</p><div id="9267"><pre><span class="hljs-symbol">C:</span>\LocalFolder>docker pull httpd <span class="hljs-keyword">Using</span> <span class="hljs-keyword">default</span> tag: latest <span class="hljs-symbol">latest:</span> Pulling <span class="hljs-keyword">from</span> library/httpd <span class="hljs-symbol">f1f26f570256:</span> Pull complete <span class="hljs-symbol">a6b093ae1967:</span> Pull complete <span class="hljs-number">6</span>b400bbb27df: Pull complete <span class="hljs-symbol">d9833ead928a:</span> Pull complete <span class="hljs-symbol">ace056404ed3:</span> Pull complete <span class="hljs-symbol">Digest:</span> sha256:f3e9eb9acace5bbc13c924293d2247a65bb59b8f062bcd98cd87ee4e18f86733 <span class="hljs-symbol">Status:</span> Downloaded newer image <span class="hljs-keyword">for</span> httpd:latest docker.io/library/httpd:latest

<span class="hljs-symbol">C:</span>\LocalFolder>docker run -it -d httpd <span class="hljs-number">70</span>aea2a43dc25f2aae5870b36b3040c2da753a8f7c79024a0ff686d5359c7802

<span class="hljs-symbol">C:</span>\LocalFolder>docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES <span class="hljs-number">70</span>aea2a43dc2 httpd <span class="hljs-string">"httpd-foreground"</span> <span class="hljs-number">7</span> seconds ago Up <span class="hljs-number">5</span> seconds <span class="hljs-number">80</span>/tcp nostalgic_galois

<span class="hljs-symbol">C:</span>\LocalFolder>docker run -it -d httpd fc9062a5141170f24daea8ad967d75da7655f49ae6b03005784768de6b7c2b0a

<span class="hljs-symbol">C:</span>\LocalFolder>docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES fc9062a51411 httpd <span class="hljs-string">"httpd-foreground"</span> <span class="hljs-number">5</span> seconds ago Up <span class="hljs-number">3</span> seconds <span class="hljs-number">80</span>/tcp kind_kilby <span class="hljs-number">70</span>aea2a43dc2 httpd <span class="hljs-string">"httpd-foreground"</span> <span class="hljs-number">27</span> seconds ago Up <span class="hljs-number">25</span> seconds <span class="hljs-number">80</span>/tcp nostalgic_galois

<span class="hljs-symbol">C:</span>\LocalFolder>docker <span class="hljs-keyword">stop</span> fc9062a51411 fc9062a51411

<span class="hljs-symbol">C:</span>\LocalFolder>docker rm fc9062a51411 fc9062a51411

<span class="hljs-symbol">C:</span>\LocalFolder></pre></div><p id="aad1"><b>Execute a command inside a running instance without login to the instance.</b></p><div id="14c6"><pre><span class="hljs-symbol">C:</span><span class="hljs-title class_">LocalFolder</span>>docker ps <span class="hljs-variable constant_">CONTAINER</span> <span class="hljs-variable constant_">ID</span> <span class="hljs-variable constant_">IMAGE</span> <span class="hljs-variable constant_">COMMAND</span> <span class="hljs-variable constant_">CREATED</span> <span class="hljs-variable constant_">STATUS</span> <span class="hljs-variable constant_">PORTS</span> <span class="hljs-variable constant_">NAMES</span> fc9062a51411 httpd <span class="hljs-string">"httpd-foreground"</span> <span class="hljs-number">13</span> minutes ago <span class="hljs-title class_">Up</span> <span class="hljs-number">13</span> minutes <span class="hljs-number">80</span>/tcp kind_kilby 70aea2a43dc2 httpd <span class="hljs-string">"httpd-foreground"</span> <span class="hljs-number">13</span> minutes ago <span class="hljs-title class_">Up</span> <span class="hljs-number">13</span> minutes <span class="hljs-number">80</span>/tcp nostalgic_galois

<span class="hljs-symbol">C:</span><span class="hljs-title class_">LocalFolder</span>>docker exec -it 70aea2a43dc2 bash root<span class="hljs-variable">@70aea2a43dc2</span><span class="hljs-symbol">:/usr/local/apache2</span><span class="hljs-comment"># ls</span> bin build cgi-bin conf error htdocs icons <span class="hljs-keyword">include</span> logs modules root<span class="hljs-variable">@70aea2a43dc2</span><span class="hljs-symbol">:/usr/local/apache2</span><span class="hljs-comment"># exit</span> exit

<span class="hljs-symbol">C:</span><span class="hljs-title class_">LocalFolder</span>></pre></div><p id="bc80"><b>Restart docker </b>(Pay attention on STATUS between two <b><i>docker ps</i></b> commands)</p><div id="1f30"><pre><span class="hljs-section">C:\LocalFolder>docker ps</span> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 70aea2a43dc2 httpd <span class="hljs-string">"httpd-foreground"</span> 18 minutes ago Up 18 minutes 80/tcp nostalgic_galois

<span class="hljs-section">C:\LocalFolder>docker restart 70aea2a43dc2</span> 70aea2a43dc2

<span class="hljs-section">C:\LocalFolder>docker ps</span> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 70aea2a43dc2 httpd <span class="hljs-string">"httpd-foreground"</span> 18 minutes ago Up 1 second 80/tcp nostalgic_galois

<span class="hljs-section">C:\LocalFolder></span></pre></div><p id="ca98"><b>Start, Stop, and Kill a docker</b></p><div id="108e"><pre><span class="hljs-symbol">C:</span>\LocalFolder>docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES <span class="hljs-number">70</span>aea2a43dc2 httpd <span class="hljs-string">"httpd-foreground"</span> <span class="hljs-number">18</span> minutes ago Up <span class="hljs-number">18</span> minutes <span class="hljs-number">80</span>/tcp nostalgic_galois

<span class="hljs-symbol">C:</span>\LocalFolder>docker restart <span class="hljs-number">70</span>aea2a43dc2 <span class="hljs-number">70</span>aea2a43dc2

<span class="hljs-symbol">C:</span>\LocalFolder>docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES <span class="hljs-number">70</span>aea2a43dc2 httpd <span class="hljs-string">"httpd-foreground"</span> <span class="hljs-number">18</span> minutes ago Up <span class="hljs-number">1</span> second <span class="hljs-number">80</span>/tcp nostalgic_galois

<span class="hljs

Options

-symbol">C:</span>\LocalFolder>docker <span class="hljs-keyword">stop</span> <span class="hljs-number">70</span>aea2a43dc2 <span class="hljs-number">70</span>aea2a43dc2

<span class="hljs-symbol">C:</span>\LocalFolder>docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

<span class="hljs-symbol">C:</span>\LocalFolder>docker start <span class="hljs-number">70</span>aea2a43dc2 <span class="hljs-number">70</span>aea2a43dc2

<span class="hljs-symbol">C:</span>\LocalFolder>docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES <span class="hljs-number">70</span>aea2a43dc2 httpd <span class="hljs-string">"httpd-foreground"</span> <span class="hljs-number">20</span> minutes ago Up <span class="hljs-number">4</span> seconds <span class="hljs-number">80</span>/tcp nostalgic_galois

<span class="hljs-symbol">C:</span>\LocalFolder>docker kill <span class="hljs-number">70</span>aea2a43dc2 <span class="hljs-number">70</span>aea2a43dc2

<span class="hljs-symbol">C:</span>\LocalFolder>docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

<span class="hljs-symbol">C:</span>\LocalFolder></pre></div><p id="2c83"><b>Docker network commands</b></p><div id="99fe"><pre>C:\LocalFolder<span class="hljs-operator">></span>docker network ls NETWORK ID NAME DRIVER <span class="hljs-keyword">SCOPE</span> e5021fa3078c bridge bridge <span class="hljs-keyword">local</span> <span class="hljs-number">4</span>a584b1ca8e2 host host <span class="hljs-keyword">local</span> <span class="hljs-number">341</span>aff89d5cc <span class="hljs-keyword">none</span> <span class="hljs-keyword">null</span> <span class="hljs-keyword">local</span>

C:\LocalFolder<span class="hljs-operator">></span>docker network

Usage: docker network COMMAND

Manage networks

Commands: <span class="hljs-keyword">connect</span> <span class="hljs-keyword">Connect</span> a container <span class="hljs-keyword">to</span> a network <span class="hljs-keyword">create</span> <span class="hljs-keyword">Create</span> a network <span class="hljs-keyword">disconnect</span> <span class="hljs-keyword">Disconnect</span> a container <span class="hljs-keyword">from</span> a network inspect Display detailed information <span class="hljs-keyword">on</span> <span class="hljs-keyword">one</span> <span class="hljs-keyword">or</span> more networks ls List networks prune Remove <span class="hljs-keyword">all</span> unused networks rm Remove <span class="hljs-keyword">one</span> <span class="hljs-keyword">or</span> more networks

Run <span class="hljs-string">'docker network COMMAND --help'</span> <span class="hljs-keyword">for</span> more information <span class="hljs-keyword">on</span> a command.

C:\LocalFolder<span class="hljs-operator">></span></pre></div><p id="f017"><b>Copy file(s) from running instance to local/host environment</b></p><div id="952d"><pre>C:\LocalFolder>cd temp

C:\LocalFolder\temp><span class="hljs-built_in">dir</span> Volume <span class="hljs-keyword">in</span> drive C <span class="hljs-keyword">is</span> Windows Volume Serial Number <span class="hljs-keyword">is</span> AC35-C317

Directory of C:\LocalFolder\temp

04/03/<span class="hljs-number">2023</span> 06:<span class="hljs-number">29</span> PM <DIR> . 04/03/<span class="hljs-number">2023</span> 06:<span class="hljs-number">29</span> PM <DIR> .. <span class="hljs-number">0</span> File(s) <span class="hljs-number">0</span> <span class="hljs-built_in">bytes</span> <span class="hljs-number">2</span> Dir(s) <span class="hljs-number">816</span>,<span class="hljs-number">605</span>,<span class="hljs-number">978</span>,<span class="hljs-number">624</span> <span class="hljs-built_in">bytes</span> free

C:\LocalFolder\temp>docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 70aea2a43dc2 httpd <span class="hljs-string">"httpd-foreground"</span> <span class="hljs-number">50</span> minutes ago Up About a minute <span class="hljs-number">80</span>/tcp nostalgic_galois

C:\LocalFolder\temp>docker cp 70aea2a43dc2:/usr/local/apache2/logs/httpd.pid .

C:\LocalFolder\temp><span class="hljs-built_in">dir</span> Volume <span class="hljs-keyword">in</span> drive C <span class="hljs-keyword">is</span> Windows Volume Serial Number <span class="hljs-keyword">is</span> AC35-C317

Directory of C:\LocalFolder\temp

04/03/<span class="hljs-number">2023</span> 06:<span class="hljs-number">29</span> PM <DIR> . 04/03/<span class="hljs-number">2023</span> 06:<span class="hljs-number">29</span> PM <DIR> .. 04/03/<span class="hljs-number">2023</span> 06:<span class="hljs-number">28</span> PM <span class="hljs-number">2</span> httpd.pid <span class="hljs-number">1</span> File(s) <span class="hljs-number">2</span> <span class="hljs-built_in">bytes</span> <span class="hljs-number">2</span> Dir(s) <span class="hljs-number">816</span>,<span class="hljs-number">605</span>,<span class="hljs-number">519</span>,<span class="hljs-number">872</span> <span class="hljs-built_in">bytes</span> free

C:\LocalFolder\temp></pre></div><p id="b30a"><b>Check instance logs and image history</b></p><div id="ed6f"><pre><span class="hljs-string">C:\LocalFolder>docker</span> <span class="hljs-string">ps</span> <span class="hljs-string">CONTAINER</span> <span class="hljs-string">ID</span> <span class="hljs-string">IMAGE</span> <span class="hljs-string">COMMAND</span> <span class="hljs-string">CREATED</span> <span class="hljs-string">STATUS</span> <span class="hljs-string">PORTS</span> <span class="hljs-string">NAMES</span> <span class="hljs-string">70aea2a43dc2</span> <span class="hljs-string">httpd</span> <span class="hljs-string">"httpd-foreground"</span> <span class="hljs-number">53</span> <span class="hljs-string">minutes</span> <span class="hljs-string">ago</span> <span class="hljs-string">Up</span> <span class="hljs-number">3</span> <span class="hljs-string">minutes</span> <span class="hljs-number">80</span><span class="hljs-string">/tcp</span> <span class="hljs-string">nostalgic_galois</span>

<span class="hljs-string">C:\LocalFolder>docker</span> <span class="hljs-string">history</span> <span class="hljs-string">httpd</span> <span class="hljs-string">IMAGE</span> <span class="hljs-string">CREATED</span> <span class="hljs-string">CREATED</span> <span class="hljs-string">BY</span> <span class="hljs-string">SIZE</span> <span class="hljs-string">COMMENT</span> <span class="hljs-string">192d41583429</span> <span class="hljs-number">11</span> <span class="hljs-string">days</span> <span class="hljs-string">ago</span> <span class="hljs-string">/bin/sh</span> <span class="hljs-string">-c</span> <span class="hljs-comment">#(nop) CMD ["httpd-foreground"] 0B</span> <span class="hljs-string"><missing></span> <span class="hljs-number">11</span> <span class="hljs-string">days</span> <span class="hljs-string">ago</span> <span class="hljs-string">/bin/sh</span> <span class="hljs-string">-c</span> <span class="hljs-comment">#(nop) EXPOSE 80 0B</span> <span class="hljs-string"><missing></span> <span class="hljs-number">11</span> <span class="hljs-string">days</span> <span class="hljs-string">ago</span> <span class="hljs-string">/bin/sh</span> <span class="hljs-string">-c</span> <span class="hljs-comment">#(nop) COPY file:c432ff61c4993ecd… 138B</span> <span class="hljs-string"><missing></span> <span class="hljs-number">11</span> <span class="hljs-string">days</span> <span class="hljs-string">ago</span> <span class="hljs-string">/bin/sh</span> <span class="hljs-string">-c</span> <span class="hljs-comment">#(nop) STOPSIGNAL SIGWINCH 0B</span> <span class="hljs-string"><missing></span> <span class="hljs-number">11</span> <span class="hljs-string">days</span> <span class="hljs-string">ago</span> <span class="hljs-string">/bin/sh</span> <span class="hljs-string">-c</span> <span class="hljs-string">set</span> <span class="hljs-string">-eux;</span> <span class="hljs-string">savedAptMark="(apt-m…</span> <span class="hljs-number">59.</span><span class="hljs-string">9MB</span> <span class="hljs-string">&lt;missing&gt;</span> <span class="hljs-number">11</span> <span class="hljs-string">days</span> <span class="hljs-string">ago</span> <span class="hljs-string">/bin/sh</span> <span class="hljs-string">-c</span> <span class="hljs-comment">#(nop) ENV HTTPD_PATCHES= 0B</span> <span class="hljs-string">&lt;missing&gt;</span> <span class="hljs-number">11</span> <span class="hljs-string">days</span> <span class="hljs-string">ago</span> <span class="hljs-string">/bin/sh</span> <span class="hljs-string">-c</span> <span class="hljs-comment">#(nop) ENV HTTPD_SHA256=d8d45f13… 0B</span> <span class="hljs-string">&lt;missing&gt;</span> <span class="hljs-number">11</span> <span class="hljs-string">days</span> <span class="hljs-string">ago</span> <span class="hljs-string">/bin/sh</span> <span class="hljs-string">-c</span> <span class="hljs-comment">#(nop) ENV HTTPD_VERSION=2.4.56 0B</span> <span class="hljs-string">&lt;missing&gt;</span> <span class="hljs-number">11</span> <span class="hljs-string">days</span> <span class="hljs-string">ago</span> <span class="hljs-string">/bin/sh</span> <span class="hljs-string">-c</span> <span class="hljs-string">set</span> <span class="hljs-string">-eux;</span> <span class="hljs-string">apt-get</span> <span class="hljs-string">update;</span> <span class="hljs-string">apt-g…</span> <span class="hljs-number">4.</span><span class="hljs-string">76MB</span> <span class="hljs-string">&lt;missing&gt;</span> <span class="hljs-number">11</span> <span class="hljs-string">days</span> <span class="hljs-string">ago</span> <span class="hljs-string">/bin/sh</span> <span class="hljs-string">-c</span> <span class="hljs-comment">#(nop) WORKDIR /usr/local/apache2 0B</span> <span class="hljs-string">&lt;missing&gt;</span> <span class="hljs-number">11</span> <span class="hljs-string">days</span> <span class="hljs-string">ago</span> <span class="hljs-string">/bin/sh</span> <span class="hljs-string">-c</span> <span class="hljs-string">mkdir</span> <span class="hljs-string">-p</span> <span class="hljs-string">"HTTPD_PREFIX"</span> <span class="hljs-string">&&</span> <span class="hljs-string">chow…</span> <span class="hljs-string">0B</span> <span class="hljs-string"><missing></span> <span class="hljs-number">11</span> <span class="hljs-string">days</span> <span class="hljs-string">ago</span> <span class="hljs-string">/bin/sh</span> <span class="hljs-string">-c</span> <span class="hljs-comment">#(nop) ENV PATH=/usr/local/apach… 0B</span> <span class="hljs-string"><missing></span> <span class="hljs-number">11</span> <span class="hljs-string">days</span> <span class="hljs-string">ago</span> <span class="hljs-string">/bin/sh</span> <span class="hljs-string">-c</span> <span class="hljs-comment">#(nop) ENV HTTPD_PREFIX=/usr/loc… 0B</span> <span class="hljs-string"><missing></span> <span class="hljs-number">11</span> <span class="hljs-string">days</span> <span class="hljs-string">ago</span> <span class="hljs-string">/bin/sh</span> <span class="hljs-string">-c</span> <span class="hljs-comment">#(nop) CMD ["bash"] 0B</span> <span class="hljs-string"><missing></span> <span class="hljs-number">11</span> <span class="hljs-string">days</span> <span class="hljs-string">ago</span> <span class="hljs-string">/bin/sh</span> <span class="hljs-string">-c</span> <span class="hljs-comment">#(nop) ADD file:60911afdacfdc216e… 80.5MB</span>

<span class="hljs-string">C:\LocalFolder>docker</span> <span class="hljs-string">logs</span> <span class="hljs-string">70aea2a43dc2</span> <span class="hljs-attr">AH00558: httpd:</span> <span class="hljs-string">Could</span> <span class="hljs-string">not</span> <span class="hljs-string">reliably</span> <span class="hljs-string">determine</span> <span class="hljs-string">the</span> <span class="hljs-string">server's</span> <span class="hljs-string">fully</span> <span class="hljs-string">qualified</span> <span class="hljs-string">domain</span> <span class="hljs-string">name,</span> <span class="hljs-string">using</span> <span class="hljs-number">172.17</span><span class="hljs-number">.0</span><span class="hljs-number">.2</span><span class="hljs-string">.</span> <span class="hljs-string">Set</span> <span class="hljs-string">the</span> <span class="hljs-string">'ServerName'</span> <span class="hljs-string">directive</span> <span class="hljs-string">globally</span> <span class="hljs-string">to</span> <span class="hljs-string">suppress</span> <span class="hljs-string">this</span> <span class="hljs-string">message</span> <span class="hljs-attr">AH00558: httpd:</span> <span class="hljs-string">Could</span> <span class="hljs-string">not</span> <span class="hljs-string">reliably</span> <span class="hljs-string">determine</span> <span class="hljs-string">the</span> <span class="hljs-string">server's</span> <span class="hljs-string">fully</span> <span class="hljs-string">qualified</span> <span class="hljs-string">domain</span> <span class="hljs-string">name,</span> <span class="hljs-string">using</span> <span class="hljs-number">172.17</span><span class="hljs-number">.0</span><span class="hljs-number">.2</span><span class="hljs-string">.</span> <span class="hljs-string">Set</span> <span class="hljs-string">the</span> <span class="hljs-string">'ServerName'</span> <span class="hljs-string">directive</span> <span class="hljs-string">globally</span> <span class="hljs-string">to</span> <span class="hljs-string">suppress</span> <span class="hljs-string">this</span> <span class="hljs-string">message</span> [<span class="hljs-string">Mon</span> <span class="hljs-string">Apr</span> <span class="hljs-number">03</span> <span class="hljs-number">21</span><span class="hljs-string">:38:53.887065</span> <span class="hljs-number">2023</span>] [<span class="hljs-string">mpm_event:notice</span>] [<span class="hljs-string">pid</span> <span class="hljs-number">1</span><span class="hljs-string">:tid</span> <span class="hljs-number">139837831376192</span>] <span class="hljs-attr">AH00489:</span> <span class="hljs-string">Apache/2.4.56</span> <span class="hljs-string">(Unix)</span> <span class="hljs-string">configured</span> <span class="hljs-string">--</span> <span class="hljs-string">resuming</span> <span class="hljs-string">normal</span> <span class="hljs-string">operations</span> [<span class="hljs-string">Mon</span> <span class="hljs-string">Apr</span> <span class="hljs-number">03</span> <span class="hljs-number">21</span><span class="hljs-string">:38:53.887807</span> <span class="hljs-number">2023</span>] [<span class="hljs-string">core:notice</span>] [<span class="hljs-string">pid</span> <span class="hljs-number">1</span><span class="hljs-string">:tid</span> <span class="hljs-number">139837831376192</span>] <span class="hljs-attr">AH00094: Command line:</span> <span class="hljs-string">'httpd -D FOREGROUND'</span> [<span class="hljs-string">Mon</span> <span class="hljs-string">Apr</span> <span class="hljs-number">03</span> <span class="hljs-number">21</span><span class="hljs-string">:57:45.758232</span> <span class="hljs-number">2023</span>] [<span class="hljs-string">mpm_event:notice</span>] [<span class="hljs-string">pid</span> <span class="hljs-number">1</span><span class="hljs-string">:tid</span> <span class="hljs-number">139837831376192</span>] <span class="hljs-attr">AH00492:</span> <span class="hljs-string">caught</span> <span class="hljs-string">SIGWINCH,</span> <span class="hljs-string">shutting</span> <span class="hljs-string">down</span> <span class="hljs-string">gracefully</span> <span class="hljs-attr">AH00558: httpd:</span> <span class="hljs-string">Could</span> <span class="hljs-string">not</span> <span class="hljs-string">reliably</span> <span class="hljs-string">determine</span> <span class="hljs-string">the</span> <span class="hljs-string">server's</span> <span class="hljs-string">fully</span> <span class="hljs-string">qualified</span> <span class="hljs-string">domain</span> <span class="hljs-string">name,</span> <span class="hljs-string">using</span> <span class="hljs-number">172.17</span><span class="hljs-number">.0</span><span class="hljs-number">.2</span><span class="hljs-string">.</span> <span class="hljs-string">Set</span> <span class="hljs-string">the</span> <span class="hljs-string">'ServerName'</span> <span class="hljs-string">directive</span> <span class="hljs-string">globally</span> <span class="hljs-string">to</span> <span class="hljs-string">suppress</span> <span class="hljs-string">this</span> <span class="hljs-string">message</span> <span class="hljs-attr">AH00558: httpd:</span> <span class="hljs-string">Could</span> <span class="hljs-string">not</span> <span class="hljs-string">reliably</span> <span class="hljs-string">determine</span> <span class="hljs-string">the</span> <span class="hljs-string">server's</span> <span class="hljs-string">fully</span> <span class="hljs-string">qualified</span> <span class="hljs-string">domain</span> <span class="hljs-string">name,</span> <span class="hljs-string">using</span> <span class="hljs-number">172.17</span><span class="hljs-number">.0</span><span class="hljs-number">.2</span><span class="hljs-string">.</span> <span class="hljs-string">Set</span> <span class="hljs-string">the</span> <span class="hljs-string">'ServerName'</span> <span class="hljs-string">directive</span> <span class="hljs-string">globally</span> <span class="hljs-string">to</span> <span class="hljs-string">suppress</span> <span class="hljs-string">this</span> <span class="hljs-string">message</span> [<span class="hljs-string">Mon</span> <span class="hljs-string">Apr</span> <span class="hljs-number">03</span> <span class="hljs-number">21</span><span class="hljs-string">:57:48.077050</span> <span class="hljs-number">2023</span>] [<span class="hljs-string">mpm_event:notice</span>] [<span class="hljs-string">pid</span> <span class="hljs-number">1</span><span class="hljs-string">:tid</span> <span class="hljs-number">140185407348032</span>] <span class="hljs-attr">AH00489:</span> <span class="hljs-string">Apache/2.4.56</span> <span class="hljs-string">(Unix)</span> <span class="hljs-string">configured</span> <span class="hljs-string">--</span> <span class="hljs-string">resuming</span> <span class="hljs-string">normal</span> <span class="hljs-string">operations</span> [<span class="hljs-string">Mon</span> <span class="hljs-string">Apr</span> <span class="hljs-number">03</span> <span class="hljs-number">21</span><span class="hljs-string">:57:48.077522</span> <span class="hljs-number">2023</span>] [<span class="hljs-string">core:notice</span>] [<span class="hljs-string">pid</span> <span class="hljs-number">1</span><span class="hljs-string">:tid</span> <span class="hljs-number">140185407348032</span>] <span class="hljs-attr">AH00094: Command line:</span> <span class="hljs-string">'httpd -D FOREGROUND'</span> [<span class="hljs-string">Mon</span> <span class="hljs-string">Apr</span> <span class="hljs-number">03</span> <span class="hljs-number">21</span><span class="hljs-string">:59:22.846920</span> <span class="hljs-number">2023</span>] [<span class="hljs-string">mpm_event:notice</span>] [<span class="hljs-string">pid</span> <span class="hljs-number">1</span><span class="hljs-string">:tid</span> <span class="hljs-number">140185407348032</span>] <span class="hljs-attr">AH00492:</span> <span class="hljs-string">caught</span> <span class="hljs-string">SIGWINCH,</span> <span class="hljs-string">shutting</span> <span class="hljs-string">down</span> <span class="hljs-string">gracefully</span> <span class="hljs-attr">AH00558: httpd:</span> <span class="hljs-string">Could</span> <span class="hljs-string">not</span> <span class="hljs-string">reliably</span> <span class="hljs-string">determine</span> <span class="hljs-string">the</span> <span class="hljs-string">server's</span> <span class="hljs-string">fully</span> <span class="hljs-string">qualified</span> <span class="hljs-string">domain</span> <span class="hljs-string">name,</span> <span class="hljs-string">using</span> <span class="hljs-number">172.17</span><span class="hljs-number">.0</span><span class="hljs-number">.2</span><span class="hljs-string">.</span> <span class="hljs-string">Set</span> <span class="hljs-string">the</span> <span class="hljs-string">'ServerName'</span> <span class="hljs-string">directive</span> <span class="hljs-string">globally</span> <span class="hljs-string">to</span> <span class="hljs-string">suppress</span> <span class="hljs-string">this</span> <span class="hljs-string">message</span> <span class="hljs-attr">AH00558: httpd:</span> <span class="hljs-string">Could</span> <span class="hljs-string">not</span> <span class="hljs-string">reliably</span> <span class="hljs-string">determine</span> <span class="hljs-string">the</span> <span class="hljs-string">server's</span> <span class="hljs-string">fully</span> <span class="hljs-string">qualified</span> <span class="hljs-string">domain</span> <span class="hljs-string">name,</span> <span class="hljs-string">using</span> <span class="hljs-number">172.17</span><span class="hljs-number">.0</span><span class="hljs-number">.2</span><span class="hljs-string">.</span> <span class="hljs-string">Set</span> <span class="hljs-string">the</span> <span class="hljs-string">'ServerName'</span> <span class="hljs-string">directive</span> <span class="hljs-string">globally</span> <span class="hljs-string">to</span> <span class="hljs-string">suppress</span> <span class="hljs-string">this</span> <span class="hljs-string">message</span> [<span class="hljs-string">Mon</span> <span class="hljs-string">Apr</span> <span class="hljs-number">03</span> <span class="hljs-number">21</span><span class="hljs-string">:59:33.556136</span> <span class="hljs-number">2023</span>] [<span class="hljs-string">mpm_event:notice</span>] [<span class="hljs-string">pid</span> <span class="hljs-number">1</span><span class="hljs-string">:tid</span> <span class="hljs-number">139695684791616</span>] <span class="hljs-attr">AH00489:</span> <span class="hljs-string">Apache/2.4.56</span> <span class="hljs-string">(Unix)</span> <span class="hljs-string">configured</span> <span class="hljs-string">--</span> <span class="hljs-string">resuming</span> <span class="hljs-string">normal</span> <span class="hljs-string">operations</span> [<span class="hljs-string">Mon</span> <span class="hljs-string">Apr</span> <span class="hljs-number">03</span> <span class="hljs-number">21</span><span class="hljs-string">:59:33.556957</span> <span class="hljs-number">2023</span>] [<span class="hljs-string">core:notice</span>] [<span class="hljs-string">pid</span> <span class="hljs-number">1</span><span class="hljs-string">:tid</span> <span class="hljs-number">139695684791616</span>] <span class="hljs-attr">AH00094: Command line:</span> <span class="hljs-string">'httpd -D FOREGROUND'</span> <span class="hljs-attr">AH00558: httpd:</span> <span class="hljs-string">Could</span> <span class="hljs-string">not</span> <span class="hljs-string">reliably</span> <span class="hljs-string">determine</span> <span class="hljs-string">the</span> <span class="hljs-string">server's</span> <span class="hljs-string">fully</span> <span class="hljs-string">qualified</span> <span class="hljs-string">domain</span> <span class="hljs-string">name,</span> <span class="hljs-string">using</span> <span class="hljs-number">172.17</span><span class="hljs-number">.0</span><span class="hljs-number">.2</span><span class="hljs-string">.</span> <span class="hljs-string">Set</span> <span class="hljs-string">the</span> <span class="hljs-string">'ServerName'</span> <span class="hljs-string">directive</span> <span class="hljs-string">globally</span> <span class="hljs-string">to</span> <span class="hljs-string">suppress</span> <span class="hljs-string">this</span> <span class="hljs-string">message</span> <span class="hljs-attr">AH00558: httpd:</span> <span class="hljs-string">Could</span> <span class="hljs-string">not</span> <span class="hljs-string">reliably</span> <span class="hljs-string">determine</span> <span class="hljs-string">the</span> <span class="hljs-string">server's</span> <span class="hljs-string">fully</span> <span class="hljs-string">qualified</span> <span class="hljs-string">domain</span> <span class="hljs-string">name,</span> <span class="hljs-string">using</span> <span class="hljs-number">172.17</span><span class="hljs-number">.0</span><span class="hljs-number">.2</span><span class="hljs-string">.</span> <span class="hljs-string">Set</span> <span class="hljs-string">the</span> <span class="hljs-string">'ServerName'</span> <span class="hljs-string">directive</span> <span class="hljs-string">globally</span> <span class="hljs-string">to</span> <span class="hljs-string">suppress</span> <span class="hljs-string">this</span> <span class="hljs-string">message</span> [<span class="hljs-string">Mon</span> <span class="hljs-string">Apr</span> <span class="hljs-number">03</span> <span class="hljs-number">22</span><span class="hljs-string">:28:38.462915</span> <span class="hljs-number">2023</span>] [<span class="hljs-string">mpm_event:notice</span>] [<span class="hljs-string">pid</span> <span class="hljs-number">1</span><span class="hljs-string">:tid</span> <span class="hljs-number">140301774556480</span>] <span class="hljs-attr">AH00489:</span> <span class="hljs-string">Apache/2.4.56</span> <span class="hljs-string">(Unix)</span> <span class="hljs-string">configured</span> <span class="hljs-string">--</span> <span class="hljs-string">resuming</span> <span class="hljs-string">normal</span> <span class="hljs-string">operations</span> [<span class="hljs-string">Mon</span> <span class="hljs-string">Apr</span> <span class="hljs-number">03</span> <span class="hljs-number">22</span><span class="hljs-string">:28:38.463976</span> <span class="hljs-number">2023</span>] [<span class="hljs-string">core:notice</span>] [<span class="hljs-string">pid</span> <span class="hljs-number">1</span><span class="hljs-string">:tid</span> <span class="hljs-number">140301774556480</span>] <span class="hljs-attr">AH00094: Command line:</span> <span class="hljs-string">'httpd -D FOREGROUND'</span>

<span class="hljs-string">C:\LocalFolder></span>

</pre></div></article></body>

Docker Introduction

Containerization, Container and Container Orchestration

Wikipedia gives definition that Containerization is operating system-level virtualization or application-level virtualization over multiple network resources so that software applications can run in isolated user spaces called containers in any cloud or non-cloud environment, regardless of type or vendor.

Container orchestration is the automation of much of the operational effort required to run containerized workloads and services. This includes a wide range of things software teams need to manage a container’s lifecycle, including provisioning, deployment, scaling (up and down), networking, load balancing and more. (source)

What is Docker?

In short, Docker is the most popular container solution. Lots of modern container orchestration technology are Docker based solution. For more comprehensive answer, please read official website from Docker.

How Docker works?

(Image Source)

Docker claims itself as client-server architecture but we normally refers to three layers as showing above:

  • Client is a software installed in local computer. It provides command lines to interactive Docker Host.
  • Docker Host could be installed in remote server, or local computer when you want to setup a development/test environment.
  • Registry is a repository to store images or extensions/plugins. Images could be created by yourself or shared/published by lots of communities or vendors. You could define your image as private or public for sharing with the community. There are a huge collection of public images available today. The most popular repository is called DockerHub.

Install Docker Desktop

Decker Desktop is the fastest way to play Docker technology in local computer. The installation contains both Docker client (a command line tool) and a GUI desktop application (with Docker daemon and container running at back). It supports Windows, Linux, and MacOS (both Apple chip and Intel chip). The installation package could be found at docker.com.

To install Docker Desktop on Windows, you need have Windows WSL2 installed. If you don’t familiar with WSL on Windows, please read through below webpage.

Now, let’s download the latest installation file from here.

Once installation file is downloaded, just double click on the filename to launch the installation.

After restart your Windows at first time after Docker Desktop installed, you will be asked to agree the service agreement.

Note, if you see a popup message asking you to update WSL, please open a Window DOS command Window with “Run as administrator”, and run command wsl — update.

To install Docker Desktop on MacOS, follow below link:

On Linux environment, we would suggest you to go with Ubuntu, Fedora, or Debian (if you are looking for RaspberryPi installation, install Docker Engine instead).

Take A First Look

Now, let’s recap what are being installed so far. Look at below screenshot from Windows installation, you got:

  • Docker command line client, called docker.exe
  • A bunch of Decker backend services including Docker Engine, Docker Buildx, Docker Compose, extension services, Kubernates, etc. , and APIs to interactive with DockerHub.
  • Docker Desktop application. You will use it to manage and monitor images created, running, and published.

If you are using MacOS or Linux, the interface looks very similar with Windows.

Launch Docker instance(s) from public images

Next, let’s try the example from Docker Desktop welcome page.

Upon completion of above command, the Docker Desktop looks like below:

So, what happens just now? Here are the details:

  1. You entered docker command in a DOS Command Window
  2. The docker command is Docker Client. It first calls Docker service running at backend, and found the image ‘docker/getting-started:latest’ doesn’t exist at local image cache (directory).
  3. Then, Docker service checks with DockerHub by calling REST API
  4. Next, the Docker service tries to download the image from DockerHub. Once file is downloaded, the Docker service verify the downloaded image file with DockerHub by using SHA256 checksum (Digest).
  5. Last, Docker service launches the instance by using the image, and running in Docker Container. Then, the Docker Container maps the port 80 from the instance to port 80 in your Windows host. The docker command will show instance id when instance startup successfully.

The status of running instance is showing in Docker Desktop. You should see the first 12 characters of the same instance id in Docker Desktop. For our example here from above screenshot, the instance id is a658d1a51d65ed3476b8728926ad4ecda986fca2ce60a5c0b29fd963cecb854a .

Now, if you open a browser with http://localhost/tutorial/. Try to play the application yourself to see if you could follow the tutorial, or modify the application yourselves.

As last step in this section, let’s play around the Docker Desktop. Click on Actions menu (the 3 dots):

Click on each menu item to see what you got. (CVE stands for common vulnerabilities and exposures. It is the cybersecurity issues documented in here).

When completed, run below commands to clean up the instance:

C:\LocalFolder>docker stop a658d1a51d65ed3476b8728926ad4ecda986fca2ce60a5c0b29fd963cecb854a
a658d1a51d65ed3476b8728926ad4ecda986fca2ce60a5c0b29fd963cecb854a

C:\LocalFolder>docker rm a658d1a51d65ed3476b8728926ad4ecda986fca2ce60a5c0b29fd963cecb854a
a658d1a51d65ed3476b8728926ad4ecda986fca2ce60a5c0b29fd963cecb854a

You should observe the Docker Desktop reflecting each command you executed above.

Build your own image(s)

To build new image, create a file called Dockerfile looks like below. This is telling docker build to use nginx:alpine image as baseline. The nginx:alpine is a public image from DockerHub.

FROM nginx:alpine

Next, let’s build the image.

C:\LocalFolder\temp\myimage1>docker images
REPOSITORY               TAG       IMAGE ID       CREATED        SIZE
httpd                    latest    192d41583429   11 days ago    145MB
docker/getting-started   latest    3e4394f6b72f   3 months ago   47MB

C:\LocalFolder\temp\myimage1>dir
 Volume in drive C is Windows
 Volume Serial Number is AC35-C317

 Directory of C:\LocalFolder\temp\myimage1

04/03/2023  09:09 PM    <DIR>          .
04/03/2023  09:09 PM    <DIR>          ..
04/03/2023  09:06 PM                19 Dockerfile
               1 File(s)             19 bytes
               2 Dir(s)  815,700,451,328 bytes free

C:\LocalFolder\temp\myimage1>docker build -t myweb .
[+] Building 1.0s (5/5) FINISHED
 => [internal] load build definition from Dockerfile                                                               0.0s
 => => transferring dockerfile: 31B                                                                                0.0s
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 2B                                                                                    0.0s
 => [internal] load metadata for docker.io/library/nginx:alpine                                                    0.7s
 => CACHED [1/1] FROM docker.io/library/nginx:alpine@sha256:c94a22b036afa972426b82d5b0a49c959786005b4f6f81ac7467c  0.0s
 => exporting to image                                                                                             0.0s
 => => exporting layers                                                                                            0.0s
 => => writing image sha256:4c56012d9024bcc72792647211226268b055ba3ec4bdaa25feb20806b3457045                       0.0s
 => => naming to docker.io/library/myweb                                                                           0.0s

C:\LocalFolder\temp\myimage1>docker images
REPOSITORY               TAG       IMAGE ID       CREATED        SIZE
myweb                    latest    4c56012d9024   5 days ago     41MB
httpd                    latest    192d41583429   11 days ago    145MB
docker/getting-started   latest    3e4394f6b72f   3 months ago   47MB

C:\LocalFolder\temp\myimage1>

Now the new image, named myweb is created. Let’s launch an instance from this image. Since this is a web server listen to part 80, we need map the port 80 from inside instance to 8080 at the host (the Windows computer you are running). So, the command would look like:

C:\LocalFolder\temp\myimage1>docker run -d -p 8080:80 myweb
d67db865fcc116bc42861873bf4b5aae2423dcfed109ec473284fcfa82e30b76

C:\LocalFolder\temp\myimage1>docker ps
CONTAINER ID   IMAGE     COMMAND                  CREATED         STATUS         PORTS                  NAMES
d67db865fcc1   myweb     "/docker-entrypoint.…"   2 minutes ago   Up 2 minutes   0.0.0.0:8080->80/tcp   quirky_lovelace
70aea2a43dc2   httpd     "httpd-foreground"       4 hours ago     Up 3 hours     80/tcp                 nostalgic_galois
C:\LocalFolder\temp\myimage1>

You could open a browser with http://localhost:8080/ for the nginx homepage.

Next, we want to customize the homepage (above) and make our own brand. To do so, we will:

  1. Download the index.html from running container.
  2. Make changes (we will change “Welcome to nginx!” to “Welcome to myweb!”)
  3. Add one more line into Dockerfile to copy the new index.html to overwrite the default index.html while building the image.
  4. Rebuild the image, and relaunch the instance.

Below are commands we use:

C:\LocalFolder\temp\myimage1>docker cp d67db865fcc1:/usr/share/nginx/html/index.html .

C:\LocalFolder\temp\myimage1>type index.html
<!DOCTYPE html>
<html>
<head>
<title>Welcome to MyWeb!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to MyWeb!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

C:\LocalFolder\temp\myimage1>

C:\LocalFolder\temp\myimage1>type Dockerfile
FROM nginx:alpine

COPY index.html //usr/share/nginx/html/


C:\LocalFolder\temp\myimage1>

C:\LocalFolder\temp\myimage1>docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

C:\LocalFolder\temp\myimage1>docker images
REPOSITORY               TAG       IMAGE ID       CREATED        SIZE
myweb                    latest    4c56012d9024   5 days ago     41MB
httpd                    latest    192d41583429   11 days ago    145MB
docker/getting-started   latest    3e4394f6b72f   3 months ago   47MB

C:\LocalFolder\temp\myimage1>docker build -t myweb .
[+] Building 2.0s (7/7) FINISHED
 => [internal] load build definition from Dockerfile                                                               0.1s
 => => transferring dockerfile: 101B                                                                               0.0s
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 2B                                                                                    0.0s
 => [internal] load metadata for docker.io/library/nginx:alpine                                                    1.5s
 => [internal] load build context                                                                                  0.1s
 => => transferring context: 654B                                                                                  0.0s
 => CACHED [1/2] FROM docker.io/library/nginx:alpine@sha256:c94a22b036afa972426b82d5b0a49c959786005b4f6f81ac7467c  0.0s
 => [2/2] COPY index.html //usr/share/nginx/html/                                                                  0.1s
 => exporting to image                                                                                             0.1s
 => => exporting layers                                                                                            0.1s
 => => writing image sha256:70afd2e29d56c4a943b07fd0a3dd4769e4af8090f0ab2c8a7b0de897e92ed709                       0.0s
 => => naming to docker.io/library/myweb                                                                           0.0s

C:\LocalFolder\temp\myimage1>

C:\LocalFolder\temp\myimage1>docker run -d -p 8080:80 myweb
56238eab4830b423fbfdf1536e7b8d2a77948c0282bc4e9580238a35d593563c

C:\LocalFolder\temp\myimage1>docker ps
CONTAINER ID   IMAGE     COMMAND                  CREATED              STATUS              PORTS                  NAMES
56238eab4830   myweb     "/docker-entrypoint.…"   About a minute ago   Up About a minute   0.0.0.0:8080->80/tcp   suspicious_hertz

Now let’s open the browser again. Note, you need refresh the page a few times ’cause your local browser might cache the static content.

Publish image

To publish docker image, you need have access to a image repository. DockerHub is the biggest docker repository and community. Now, let’s go to signup page here to create a free account in DockerHub if you haven’t done so yet.

Next, login to DockerHub, and create a new private repository looks like below:

Now, let’s go back to local computer and use below command to login to DockerHub:

C:\LocalFolder\temp\myimage1>docker login -u mbtmp
Password:
Login Succeeded

Logging in with your password grants your terminal complete access to your account.
For better security, log in with a limited-privilege personal access token. Learn more at https://docs.docker.com/go/access-tokens/

C:\LocalFolder\temp\myimage1>

Then, let’s rebuild the image with new tag (to match the repository):

C:\LocalFolder\temp\myimage1>docker build -t mbtmp/docker-introduction .
[+] Building 1.1s (8/8) FINISHED
 => [internal] load build definition from Dockerfile                                                               0.0s
 => => transferring dockerfile: 31B                                                                                0.0s
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 2B                                                                                    0.0s
 => [internal] load metadata for docker.io/library/nginx:alpine                                                    0.7s
 => [auth] library/nginx:pull token for registry-1.docker.io                                                       0.0s
 => [internal] load build context                                                                                  0.0s
 => => transferring context: 32B                                                                                   0.0s
 => [1/2] FROM docker.io/library/nginx:alpine@sha256:c94a22b036afa972426b82d5b0a49c959786005b4f6f81ac7467ca5538d0  0.0s
 => CACHED [2/2] COPY index.html /usr/share/nginx/html/                                                            0.0s
 => exporting to image                                                                                             0.0s
 => => exporting layers                                                                                            0.0s
 => => writing image sha256:dd205ee3afc7ae27ad1f5d669612f5a9e3f44dc6e6a825be0b6f4830871ca3be                       0.0s
 => => naming to docker.io/mbtmp/docker-introduction                                                               0.0s

C:\LocalFolder\temp\myimage1>

Let’s test the image locally. This time, we map the port to 8081.

C:\LocalFolder\temp\myimage1>docker images
REPOSITORY                  TAG       IMAGE ID       CREATED          SIZE
myweb                       latest    dd205ee3afc7   35 minutes ago   41MB
mbtmp/docker-introduction   latest    dd205ee3afc7   35 minutes ago   41MB
httpd                       latest    192d41583429   11 days ago      145MB
docker/getting-started      latest    3e4394f6b72f   3 months ago     47MB

C:\LocalFolder\temp\myimage1>docker run -d -p 8081:80 mbtmp/docker-introduction
aab1b984578b803acc5011b0219cc3b80d56e26d03a0876822725e5468d815dd

C:\LocalFolder\temp\myimage1>docker ps
CONTAINER ID   IMAGE                       COMMAND                  CREATED          STATUS          PORTS                  NAMES
aab1b984578b   mbtmp/docker-introduction   "/docker-entrypoint.…"   6 seconds ago    Up 4 seconds    0.0.0.0:8081->80/tcp   eloquent_sammet
56238eab4830   myweb                       "/docker-entrypoint.…"   32 minutes ago   Up 32 minutes   0.0.0.0:8080->80/tcp   suspicious_hertz

C:\LocalFolder\temp\myimage1>

Everything looks good, let’s publish (push) to DockerHub.

C:\LocalFolder\temp\myimage1>docker push mbtmp/docker-introduction
Using default tag: latest
The push refers to repository [docker.io/mbtmp/docker-introduction]
0f239a39b256: Pushed
31531248c7cb: Mounted from library/nginx
f9cb3f1f1d3d: Mounted from library/nginx
f0fb842dea41: Mounted from library/nginx
c1cd5c8c68ef: Mounted from library/nginx
1d54586a1706: Mounted from library/nginx
1003ff723696: Mounted from library/nginx
f1417ff83b31: Mounted from library/nginx
latest: digest: sha256:c421138f606127bee3dd817aa958f86f0e71f1bfff0847737397d5346cd3ffcc size: 1988

C:\LocalFolder\temp\myimage1>

Now, go to DockerHub to check the image just published.

Last, let’s clean up all local images and containers, and pull your image from DockerHub then execute it.

C:\LocalFolder\temp\myimage1>docker run -d -p 8082:80 mbtmp/docker-introduction
Unable to find image 'mbtmp/docker-introduction:latest' locally
latest: Pulling from mbtmp/docker-introduction
f56be85fc22e: Already exists
2ce963c369bc: Already exists
59b9d2200e63: Already exists
3e1e579c95fe: Already exists
547a97583f72: Already exists
1f21f983520d: Already exists
c23b4f8cf279: Already exists
98ec662e4cb1: Already exists
Digest: sha256:c421138f606127bee3dd817aa958f86f0e71f1bfff0847737397d5346cd3ffcc
Status: Downloaded newer image for mbtmp/docker-introduction:latest
ffdaf619a7a135a63e733825469ecae17c4b75de573e594138beaeb3458ae8d4

C:\LocalFolder\temp\myimage1>

Common Docker Commands

Now, let’s play the most common docker commands. For full references of all docker commands, please refer to official website.

Docker version and Docker info:

C:\LocalFolder>docker version
Client:
 Cloud integration: v1.0.31
 Version:           20.10.23
 API version:       1.41
 Go version:        go1.18.10
 Git commit:        7155243
 Built:             Thu Jan 19 17:43:10 2023
 OS/Arch:           windows/amd64
 Context:           default
 Experimental:      true

Server: Docker Desktop 4.17.1 (101757)
 Engine:
  Version:          20.10.23
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.10
  Git commit:       6051f14
  Built:            Thu Jan 19 17:32:04 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.18
  GitCommit:        2456e983eb9e37e47538f59ea18f2043c9a73640
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

C:\LocalFolder>docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.10.3)
  compose: Docker Compose (Docker Inc., v2.15.1)
  dev: Docker Dev Environments (Docker Inc., v0.1.0)
  extension: Manages Docker extensions (Docker Inc., v0.2.18)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.25.0)
  scout: Command line tool for Docker Scout (Docker Inc., v0.6.0)

Server:
 Containers: 1
  Running: 0
  Paused: 0
  Stopped: 1
 Images: 2
 Server Version: 20.10.23
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 2456e983eb9e37e47538f59ea18f2043c9a73640
 runc version: v1.1.4-0-g5fd4c4d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.15.90.1-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 15.54GiB
 Name: docker-desktop
 ID: GFFK:5WLD:YAFM:ZL2V:EJI7:RPWI:RWVM:ANBA:X7HY:YK3N:RTVV:FLLT
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false


C:\LocalFolder>C:\LocalFolder>

Download images (pull, from DockerHub by default), list downloaded images, and delete downloaded images:

C:\LocalFolder>docker pull httpd
Using default tag: latest
latest: Pulling from library/httpd
f1f26f570256: Pull complete
a6b093ae1967: Pull complete
6b400bbb27df: Pull complete
d9833ead928a: Pull complete
ace056404ed3: Pull complete
Digest: sha256:f3e9eb9acace5bbc13c924293d2247a65bb59b8f062bcd98cd87ee4e18f86733
Status: Downloaded newer image for httpd:latest
docker.io/library/httpd:latest

C:\LocalFolder>docker images
REPOSITORY               TAG       IMAGE ID       CREATED        SIZE
httpd                    latest    192d41583429   11 days ago    145MB
docker/getting-started   latest    3e4394f6b72f   3 months ago   47MB

C:\LocalFolder>docker image rm httpd
Untagged: httpd:latest
Untagged: httpd@sha256:f3e9eb9acace5bbc13c924293d2247a65bb59b8f062bcd98cd87ee4e18f86733
Deleted: sha256:192d41583429c96af40eb3af02d4baaf6398c178e832c114abe030ff986ee826
Deleted: sha256:02cfaead37b294d643f4d491e109405b87c6771dab37869e2df8c69f9be45b99
Deleted: sha256:6f8156ee44091069a7feb88bf3dfe12e9e2c7a161ecd34d11a50af1336359eff
Deleted: sha256:19ebb8bacf71ef69d0b854e3640aff8f7e36698837eca9d17b3c84787a369b1f
Deleted: sha256:af68c6e8ab5b3e93e58afcc42569ef9fa784b28d017689fd086a03a54ad21ebd
Deleted: sha256:3af14c9a24c941c626553628cf1942dcd94d40729777f2fcfbcd3b8a3dfccdd6

C:\LocalFolder>docker images
REPOSITORY               TAG       IMAGE ID       CREATED        SIZE
docker/getting-started   latest    3e4394f6b72f   3 months ago   47MB

C:\LocalFolder>

Start a docker instance from image (if not in local, will pull from DockerHub), find running instances, stop running instances. Note, you could run multiple instances from the same image.

C:\LocalFolder>docker pull httpd
Using default tag: latest
latest: Pulling from library/httpd
f1f26f570256: Pull complete
a6b093ae1967: Pull complete
6b400bbb27df: Pull complete
d9833ead928a: Pull complete
ace056404ed3: Pull complete
Digest: sha256:f3e9eb9acace5bbc13c924293d2247a65bb59b8f062bcd98cd87ee4e18f86733
Status: Downloaded newer image for httpd:latest
docker.io/library/httpd:latest

C:\LocalFolder>docker run -it -d httpd
70aea2a43dc25f2aae5870b36b3040c2da753a8f7c79024a0ff686d5359c7802

C:\LocalFolder>docker ps
CONTAINER ID   IMAGE     COMMAND              CREATED         STATUS         PORTS     NAMES
70aea2a43dc2   httpd     "httpd-foreground"   7 seconds ago   Up 5 seconds   80/tcp    nostalgic_galois

C:\LocalFolder>docker run -it -d httpd
fc9062a5141170f24daea8ad967d75da7655f49ae6b03005784768de6b7c2b0a

C:\LocalFolder>docker ps
CONTAINER ID   IMAGE     COMMAND              CREATED          STATUS          PORTS     NAMES
fc9062a51411   httpd     "httpd-foreground"   5 seconds ago    Up 3 seconds    80/tcp    kind_kilby
70aea2a43dc2   httpd     "httpd-foreground"   27 seconds ago   Up 25 seconds   80/tcp    nostalgic_galois

C:\LocalFolder>docker stop fc9062a51411
fc9062a51411

C:\LocalFolder>docker rm fc9062a51411
fc9062a51411

C:\LocalFolder>

Execute a command inside a running instance without login to the instance.

C:\LocalFolder>docker ps
CONTAINER ID   IMAGE     COMMAND              CREATED          STATUS          PORTS     NAMES
fc9062a51411   httpd     "httpd-foreground"   13 minutes ago   Up 13 minutes   80/tcp    kind_kilby
70aea2a43dc2   httpd     "httpd-foreground"   13 minutes ago   Up 13 minutes   80/tcp    nostalgic_galois

C:\LocalFolder>docker exec -it 70aea2a43dc2 bash
root@70aea2a43dc2:/usr/local/apache2# ls
bin  build  cgi-bin  conf  error  htdocs  icons  include  logs  modules
root@70aea2a43dc2:/usr/local/apache2# exit
exit

C:\LocalFolder>

Restart docker (Pay attention on STATUS between two docker ps commands)

C:\LocalFolder>docker ps
CONTAINER ID   IMAGE     COMMAND              CREATED          STATUS          PORTS     NAMES
70aea2a43dc2   httpd     "httpd-foreground"   18 minutes ago   Up 18 minutes   80/tcp    nostalgic_galois

C:\LocalFolder>docker restart 70aea2a43dc2
70aea2a43dc2

C:\LocalFolder>docker ps
CONTAINER ID   IMAGE     COMMAND              CREATED          STATUS        PORTS     NAMES
70aea2a43dc2   httpd     "httpd-foreground"   18 minutes ago   Up 1 second   80/tcp    nostalgic_galois

C:\LocalFolder>

Start, Stop, and Kill a docker

C:\LocalFolder>docker ps
CONTAINER ID   IMAGE     COMMAND              CREATED          STATUS          PORTS     NAMES
70aea2a43dc2   httpd     "httpd-foreground"   18 minutes ago   Up 18 minutes   80/tcp    nostalgic_galois

C:\LocalFolder>docker restart 70aea2a43dc2
70aea2a43dc2

C:\LocalFolder>docker ps
CONTAINER ID   IMAGE     COMMAND              CREATED          STATUS        PORTS     NAMES
70aea2a43dc2   httpd     "httpd-foreground"   18 minutes ago   Up 1 second   80/tcp    nostalgic_galois

C:\LocalFolder>docker stop 70aea2a43dc2
70aea2a43dc2

C:\LocalFolder>docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

C:\LocalFolder>docker start 70aea2a43dc2
70aea2a43dc2

C:\LocalFolder>docker ps
CONTAINER ID   IMAGE     COMMAND              CREATED          STATUS         PORTS     NAMES
70aea2a43dc2   httpd     "httpd-foreground"   20 minutes ago   Up 4 seconds   80/tcp    nostalgic_galois

C:\LocalFolder>docker kill 70aea2a43dc2
70aea2a43dc2

C:\LocalFolder>docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

C:\LocalFolder>

Docker network commands

C:\LocalFolder>docker network ls
NETWORK ID     NAME      DRIVER    SCOPE
e5021fa3078c   bridge    bridge    local
4a584b1ca8e2   host      host      local
341aff89d5cc   none      null      local

C:\LocalFolder>docker network

Usage:  docker network COMMAND

Manage networks

Commands:
  connect     Connect a container to a network
  create      Create a network
  disconnect  Disconnect a container from a network
  inspect     Display detailed information on one or more networks
  ls          List networks
  prune       Remove all unused networks
  rm          Remove one or more networks

Run 'docker network COMMAND --help' for more information on a command.

C:\LocalFolder>

Copy file(s) from running instance to local/host environment

C:\LocalFolder>cd temp

C:\LocalFolder\temp>dir
 Volume in drive C is Windows
 Volume Serial Number is AC35-C317

 Directory of C:\LocalFolder\temp

04/03/2023  06:29 PM    <DIR>          .
04/03/2023  06:29 PM    <DIR>          ..
               0 File(s)              0 bytes
               2 Dir(s)  816,605,978,624 bytes free

C:\LocalFolder\temp>docker ps
CONTAINER ID   IMAGE     COMMAND              CREATED          STATUS              PORTS     NAMES
70aea2a43dc2   httpd     "httpd-foreground"   50 minutes ago   Up About a minute   80/tcp    nostalgic_galois

C:\LocalFolder\temp>docker cp 70aea2a43dc2:/usr/local/apache2/logs/httpd.pid .

C:\LocalFolder\temp>dir
 Volume in drive C is Windows
 Volume Serial Number is AC35-C317

 Directory of C:\LocalFolder\temp

04/03/2023  06:29 PM    <DIR>          .
04/03/2023  06:29 PM    <DIR>          ..
04/03/2023  06:28 PM                 2 httpd.pid
               1 File(s)              2 bytes
               2 Dir(s)  816,605,519,872 bytes free

C:\LocalFolder\temp>

Check instance logs and image history

C:\LocalFolder>docker ps
CONTAINER ID   IMAGE     COMMAND              CREATED          STATUS         PORTS     NAMES
70aea2a43dc2   httpd     "httpd-foreground"   53 minutes ago   Up 3 minutes   80/tcp    nostalgic_galois

C:\LocalFolder>docker history httpd
IMAGE          CREATED       CREATED BY                                      SIZE      COMMENT
192d41583429   11 days ago   /bin/sh -c #(nop)  CMD ["httpd-foreground"]     0B
<missing>      11 days ago   /bin/sh -c #(nop)  EXPOSE 80                    0B
<missing>      11 days ago   /bin/sh -c #(nop) COPY file:c432ff61c4993ecd…   138B
<missing>      11 days ago   /bin/sh -c #(nop)  STOPSIGNAL SIGWINCH          0B
<missing>      11 days ago   /bin/sh -c set -eux;   savedAptMark="$(apt-m…   59.9MB
<missing>      11 days ago   /bin/sh -c #(nop)  ENV HTTPD_PATCHES=           0B
<missing>      11 days ago   /bin/sh -c #(nop)  ENV HTTPD_SHA256=d8d45f13…   0B
<missing>      11 days ago   /bin/sh -c #(nop)  ENV HTTPD_VERSION=2.4.56     0B
<missing>      11 days ago   /bin/sh -c set -eux;  apt-get update;  apt-g…   4.76MB
<missing>      11 days ago   /bin/sh -c #(nop) WORKDIR /usr/local/apache2    0B
<missing>      11 days ago   /bin/sh -c mkdir -p "$HTTPD_PREFIX"  && chow…   0B
<missing>      11 days ago   /bin/sh -c #(nop)  ENV PATH=/usr/local/apach…   0B
<missing>      11 days ago   /bin/sh -c #(nop)  ENV HTTPD_PREFIX=/usr/loc…   0B
<missing>      11 days ago   /bin/sh -c #(nop)  CMD ["bash"]                 0B
<missing>      11 days ago   /bin/sh -c #(nop) ADD file:60911afdacfdc216e…   80.5MB

C:\LocalFolder>docker logs 70aea2a43dc2
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
[Mon Apr 03 21:38:53.887065 2023] [mpm_event:notice] [pid 1:tid 139837831376192] AH00489: Apache/2.4.56 (Unix) configured -- resuming normal operations
[Mon Apr 03 21:38:53.887807 2023] [core:notice] [pid 1:tid 139837831376192] AH00094: Command line: 'httpd -D FOREGROUND'
[Mon Apr 03 21:57:45.758232 2023] [mpm_event:notice] [pid 1:tid 139837831376192] AH00492: caught SIGWINCH, shutting down gracefully
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
[Mon Apr 03 21:57:48.077050 2023] [mpm_event:notice] [pid 1:tid 140185407348032] AH00489: Apache/2.4.56 (Unix) configured -- resuming normal operations
[Mon Apr 03 21:57:48.077522 2023] [core:notice] [pid 1:tid 140185407348032] AH00094: Command line: 'httpd -D FOREGROUND'
[Mon Apr 03 21:59:22.846920 2023] [mpm_event:notice] [pid 1:tid 140185407348032] AH00492: caught SIGWINCH, shutting down gracefully
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
[Mon Apr 03 21:59:33.556136 2023] [mpm_event:notice] [pid 1:tid 139695684791616] AH00489: Apache/2.4.56 (Unix) configured -- resuming normal operations
[Mon Apr 03 21:59:33.556957 2023] [core:notice] [pid 1:tid 139695684791616] AH00094: Command line: 'httpd -D FOREGROUND'
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
[Mon Apr 03 22:28:38.462915 2023] [mpm_event:notice] [pid 1:tid 140301774556480] AH00489: Apache/2.4.56 (Unix) configured -- resuming normal operations
[Mon Apr 03 22:28:38.463976 2023] [core:notice] [pid 1:tid 140301774556480] AH00094: Command line: 'httpd -D FOREGROUND'

C:\LocalFolder>

Docker
Docker Desktop
Container Orchestration
Containerization
Dockerhub
Recommended from ReadMedium