Post

Chạy Docker trên VPS Google Cloud của Firebase Studio

Cách chạy Docker trên VPS Google Cloud

Chạy Docker trên VPS Google Cloud của Firebase Studio

Kích hoạt Docker trên Firebase Studio Cloud

  • Như bài viết trước đã hướng dẫn cách dựng một Ubuntu Cloud cấu hình cao.

  • Mặc định bạn sẽ không sử dụng được Docker trên chính Ubuntu này, nhưng để kích hoạt Docker bạn cần làm như sau:

  • Kiểm tra mask services trên Ubuntu bằng

1
2
3
4
5
sudo systemctl unmask docker.service
sudo systemctl unmask docker.socket
sudo systemctl unmask containerd
sudo systemctl enable containerd
sudo systemctl start containerd
  • Thực hiện toàn bộ dòng lệnh kết quả như sau
1
2
3
4
5
6
7
8
9
10
11
● containerd.service - containerd container runtime
     Loaded: loaded (/usr/lib/systemd/system/containerd.service; enabled; preset: enabled)
     Active: active (running) since Thu 2025-04-17 08:57:18 UTC; 9s ago
       Docs: https://containerd.io
    Process: 3813 ExecStartPre=/sbin/modprobe overlay (code=exited, status=1/FAILURE)
   Main PID: 3814 (containerd)
      Tasks: 17
     Memory: 14.5M (peak: 16.2M)
        CPU: 95ms
     CGroup: /k8s.io/a0c190c0243ea775b4c821424d111dc922bcbb967cf23fd3b073ab08db2d3dbd/system.slice/containerd.service

1
2
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo nano /etc/systemd/system/docker.service.d/override.conf
  • Thêm nội dung vào file override.conf
1
2
3
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock
1
2
sudo systemctl daemon-reload
sudo systemctl restart docker
  • Docker works!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
docker run --rm hello-world

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/

This post is licensed under CC BY 4.0 by the author.

Trending Tags