Docker Desktop 要收錢了,我們該怎麼辦?

docker logo

前言

在今年八月底 Docker 發出了一篇標題為 Docker is Updating and Extending Our Product Subscriptions 的公告,當中描述了 Docker Desktop 的 Service Agreement 有了一些變更,其中最重要的更新如下:

Docker Desktop remains free for small businesses (fewer than 250 employees AND less than $10 million in annual revenue), personal use, education, and non-commercial open source projects.

It requires a paid subscription (Pro, Team or Business), starting at $5 per user per month, for professional use in larger businesses

簡單的說,如果你的公司人數大於 250 人,或是你公司一年的 revenue 超過 USD 10 million(大概是 2800 萬台幣左右),那麼你們公司就得付費才能使用 Docker Desktop,每個使用者依據不同的等級 (Pro, Team, Business) 要付出 5 美元到 21 美元不等的費用。對於很多公司來說,這也是一筆不算小的支出,所以就有人研究如何替代 Docker Dekstop 的做法。這邊分別介紹在 Mac 以及 Windows 上面的解法:

Mac – 用 Podman 代替 docker

podman

podman 是除了 docker 之外的另一個 container engine,另外也提供了跟 docker 相容的 CLI,簡單來說可以把它當成一個 docker 的替代品。在 MacOS 上面要使用 podman,可以透過以下的步驟:

  1. brew install podman
  2. 創建一個給 Podman 執行的 vm
$ podman machine init 

Downloading VM image: fedora-coreos-34.20210919.1.0-qemu.x86_64.qcow2.xz: done
Extracting compressed file
  1. 啟動 vm
$ podman machine start

INFO[0000] waiting for clients...
INFO[0000] listening tcp://0.0.0.0:7777
INFO[0000] new connection from  to /var/folders/7c/2_5hvfw13bq8mq8wbtjmjfm40000gn/T/podman/qemu_podman-machine-default.sock
Waiting for VM ...
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]



  1. 測試一下 podman 是不是可以正常運作
$ podman run hello-world
Resolved "hello-world" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull docker.io/library/hello-world:latest...
Getting image source signatures
Copying blob sha256:2db29710123e3e53a794f2694094b9b4338aa9ee5c40b930cb8063a1be392c54
Copying blob sha256:2db29710123e3e53a794f2694094b9b4338aa9ee5c40b930cb8063a1be392c54
Copying config sha256:feb5d9fea6a5e9606aa995e879d862b825965ba48de054caab5ef356dc6b3412
Writing manifest to image destination
Storing signatures

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

如果這邊都沒問題,那麼代表你已經成功地在 MacOS 裝起來 podman 了。

  1. alias docker=podman 加入你的 .bashrc 或是 .zshrc 當中,用 podman CLI 來代替 docker CLI

之後,我們只要記得在要使用 container 之前,使用 podman machine start,之後所有在之前 docker 熟悉的指令都可以使用。

事情沒有這麼簡單…

上面看起來好像一切很美好,不過其實還是有個很大的問題。目前的 podman 是跑在 podman machine 的 vm 當中,所以如果我們想要把 Host OS (MacOS) 當中的 volume 直接 mount 到 container 當中的時候,會因為當中隔了一層 vm 而出現問題。關於這點在 podman 的 issue 當中有很多人在討論,希望在不遠的未來可以解決這個問題。

Windows – 用 WSL 跑 docker

在 Windows 上面的 solution 目前倒是相對單純,自從 Windows 10 開始有了 WSL2 之後,其實最簡單的最法就是直接在 WSL ubuntu 當中跑 docker 就好。簡單來說兩個步驟:

  1. 參考 Install WSL 在你的 Windows 10 當中安裝 WSL
  2. 參考 Install Docker Engine on Ubuntu 安裝 docker

如果你使用 Windows 而還沒有開始用 WSL 的人快用吧!保證會讓你的開發體驗更好。

結論

對於筆者來說,目前看起來在 MacOS 上面 Podman 還是沒辦法完全滿足 Docker Desktop 上面的日常需求。畢竟 volume mount 算是在開發上面蠻常使用到的功能,只能夠等到 podman 未來支援度更好些。如果你們所在的組織是需要付錢的組織也暫時不用太擔心,雖然在 2021/8/31 Docker Desktop 已經公告了 Service Agreement 修改的事情,不過公告當中也是有這麼一段:

While the effective date of these terms is August 31, 2021, there is a grace period until January 31, 2022 for those that require a paid subscription to use Docker Desktop.

所以其實在明年 1 月 31 號之前還是有一段緩衝期,大家還是可以在這段時間試試看有沒有別的解法,如果最後找不到的話就還是乖乖付錢吧!Docker 畢竟還是一家商業公司,還是得要賺錢才能長久營運下去,之後也才能為大家帶來更方便的開發體驗。

參考



Leave a Reply

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *