Skip to content
Go back

docker-ce install on ubuntu 24.04

Updated:

在 Ubuntu 24.04 上安装 docker-ce

准备工作

apt update  
apt install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

安装docker-ce

apt update
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
systemctl status docker
docker info

常用操作命令

docker commit -m "What you did to the image" -a "Author Name" container_id repository/new_image_name
-m开关用于提交消息
-a用于指定作者
docker commit -m "added Node.js" -a "sammy" d9b100f2f636 sammy/ubuntu-nodejs
docker network create proxy_net
docker network create --subnet=172.20.0.0/16 proxy_net
docker network ls
docker network connect proxy_net c80037ceb798
docker network connect proxy_net 5c76617623c1
docker network inspect proxy_net
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' 6cf287434c93
docker compose version
docker network rm proxy_net
docker network create --driver bridge --ipv6 --subnet 2001:db8:abc::/64 proxy_net
# 这里的 --subnet 2001:db8:abc::/64 只是一个示例,确保它不冲突,并且与你Docker Daemon的fixed-cidr-v6兼容。
# 更简单的方式是让Docker自己分配,只要docker daemon的ipv6启用了,它会从fixed-cidr-v6中为新创建的网络分配一个子网。
# 所以通常只需:
docker network create --driver bridge --ipv6 proxy_net

Share this post on:

Previous Post
How to Install Docker Swarm on Ubuntu 24.04
Next Post
iptable reset