Ubuntu安装搭建docker环境
2021/7/10 7:08:14
本文主要是介绍Ubuntu安装搭建docker环境,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
开启IP转发
查看是否开启
- docker通讯需要开启ipforward
sysctl -a | grep ipv4forward
net.ipv4.ip_forward = 1
表示开启
开启ipforward
- 没开启的话修改参数把他开启
echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf
安装一些工具和依赖包
apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
下载密钥
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
添加软件仓库
sudo add-apt-repository \ "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu \ $(lsb_release -cs) \ stable"
更新仓库
sudo apt-get update
安装docker-ce
sudo apt-get install docker-ce
启动doceker服务
systemctl enable --now
验证是否安装成功
docker info
root@u20-58:/home/u20# docker info Client: Context: default Debug Mode: false Plugins: app: Docker App (Docker Inc., v0.9.1-beta3) buildx: Build with BuildKit (Docker Inc., v0.5.1-docker) scan: Docker Scan (Docker Inc., v0.8.0) Server: Containers: 3 Running: 2 Paused: 0 Stopped: 1 Images: 1 Server Version: 20.10.7 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: 1 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.runc.v2 io.containerd.runtime.v1.linux runc Default Runtime: runc Init Binary: docker-init containerd version: d71fcd7d8303cbf684402823e425e9dd2e99285d runc version: b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7 init version: de40ad0 Security Options: apparmor seccomp Profile: default Kernel Version: 5.8.0-48-generic Operating System: Ubuntu 20.10 OSType: linux Architecture: x86_64 CPUs: 2 Total Memory: 1.909GiB Name: u20-58 ID: 5XG5:337F:AKD5:POKR:KOMK:UUFO:7BPM:TZ7O:E6IS:OXQ7:I5RV:NBBQ Docker Root Dir: /var/lib/docker Debug Mode: false Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false
这篇关于Ubuntu安装搭建docker环境的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-19Docker-Compose容器集群化项目实战:新手入门指南
- 2024-11-19Docker镜像仓库项目实战:新手入门教程
- 2024-11-19Docker容器化部署项目实战:新手入门教程
- 2024-11-19Docker-Compose容器集群化资料入门教程
- 2024-11-19Docker镜像仓库资料详解:新手入门教程
- 2024-11-19Docker容器化部署资料:新手入门指南
- 2024-11-19Docker-Compose容器集群化教程:从入门到实践
- 2024-11-19Docker镜像仓库教程:新手入门指南
- 2024-11-19Docker容器化部署教程:初学者指南
- 2024-11-18Docker-Compose容器集群化入门教程