[Note] Docker相關筆記

    Container已經成為目前雲端的主流,雖然OCI的規格還在進化,不過目前就還是以docker為主。
    所以,就先由此做一些筆記吧!

Add volume with bind mount :

# docker run -idt --name [container name] -v "$pwd/[desire folder]:[container folder] [image]

Run a new container with restrict memory/cpu core :

# docker run -idt --name [container name] --cpuset-cpus="[core No. of the cpu] --memory="4G" --memory-swap="4G" [image]
上面指令指的是除了限制要用CPU core 當中的那一(幾)個core、以及限制container 至多只能使用4G memory,而且不能使用swap的資源

Change the tag of the image :

# docker tag [image id] [desired Repo: version]

Build image from a docker file :

# docker build -t [tag_name] .
其中 [tag_name]必須全部小寫,最後的 "." 表示在該目錄下進行build的動作。
至於Dockerfile,就是令一個可以好好討論的重點了....。
     因為有時需要用到curl下載一些檔案:
curl [URL] -o [filename]
目前大概只有記到這部份,有更多筆記就再新增了。

這個網誌中的熱門文章

浪淘沙--不僅是獨立生命的故事

一些回憶的隨筆~

[舊文]飛彈防禦:射落飛彈,強化盟邦