首页 > 系统相关 >Ubuntu 18.04安装Docker步骤及错误解决方法

Ubuntu 18.04安装Docker步骤及错误解决方法

时间:2022-12-27 17:02:07浏览次数:43  
标签:18.04 get sudo apt Ubuntu Docker docker ubuntu

Ubuntu 18.04安装Docker步骤以及错误解决方法

sudo apt-get update
sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

执行上述命令,却报以下错误:

jason@ubuntu:~$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 gsettings-desktop-schemas : Breaks: mutter (< 3.31.4) but 3.28.4+git20200505-0ubuntu18.04.2 is to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

解决方案:

jason@ubuntu:~$ sudo apt install gsettings-desktop-schemas

jason@ubuntu:~$ sudo apt install build-essential

  1. 然后重新安装:
jason@ubuntu:~$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

测试是否安装成功:

jason@ubuntu:~$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete 
Digest: sha256:c77be1d3a47d0caf71a82dd893ee61ce01f32fc758031a6ec4cf1389248bb833
Status: Downloaded newer image for hello-world:latest

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/

标签:18.04,get,sudo,apt,Ubuntu,Docker,docker,ubuntu
From: https://www.cnblogs.com/jason-huawen/p/17008438.html

相关文章

  • 【Ubuntu搭建gitlab】gitlab搭建过程
    一、服务器硬件水平搭建gitlab服务器最低配置要求2核4G,低于这个配置的服务器运行效果很差二、安装依赖项sudoapt-getupdatesudoapt-getinstall-ycurlopenssh-s......
  • 解决 Ubuntu apt-get Could not get lock varlibdpkglock-frontend
    解决Ubuntuapt-getCouldnotgetlock/var/lib/dpkg/lock-frontend.E:Couldnotgetlock/var/lib/dpkg/lock-frontend.Itisheldbyprocess1927(unattended-......
  • Docker学习笔记
    安装Docker卸载docker(可选)没安装过可跳过步yumremovedocker\docker-client\docker-client-latest\doc......
  • docker镜像的创建
    一、docker镜像的创建1、创建镜像的方法创建镜像有三种方法,分别为基于已有镜像创建、基于本地模板创建以及基于Dockerfile创建。2、基于现有镜像创建(1)启动一个镜像,在容......
  • ubuntu扩展磁盘空间
    首先感谢这位仁兄写的教程,很详细很清晰,一步一步下来顺利扩展成功硬盘空间,为防止某天挂掉重记录下,原文地址如下:https://blog.csdn.net/Honour_Forever/article/details/116......
  • 在 Ubuntu 22.04 上部署 WordPress
    很简单的事情被搞得很复杂,踩了很多坑……以及莫名其妙的错误。本来碰壁了之后会一拖再拖。昨天新冠阳性难受了一整天,晚上退烧了,不想学数学就想搞搞这个,第二天早上就弄好了......
  • Docker一键部署Golang项目
    Docker部署go项目首先我们把我们写的go项目通过Xftp传到服务器上面,或者通过git从Coding里面拉取一份,未来方便起见我是把我的所有的go项目都放在了/usr/local/goproject目......
  • docker技术原理
    一、docker技术原理简介    集装箱这是现实生活中大家都熟知的,它的主要作用就是存放货物,彼此独立开来,相互隔离。docker也是运用了集装箱思想,可以把我们工作中常用......
  • 【Tomcat】ubuntu系统安装Tomcat
    sudoapt-getinstallapache2 https://www.cnblogs.com/srong0221/p/16857233.htmlTomcat简介Tomcat服务器是一个免费的开放源代码的Web应用服务器,属于轻量级应用......
  • Dockerfile构建镜像(八)
    一、构建镜像现在让我们再回到之前定制的nginx镜像的Dockerfile来。现在我们明白了这个Dockerfile的内容,那么让我们来构建这个镜像吧。在Dockerfile文件所在目录......