Linux 拨号vps windows公众号手机端

debian安装docker命令(debian11安装docker)

lewis 5年前 (2020-11-21) 阅读数 12 #VPS/云服务器

本文目录:

  • 1、<"http://#Debian11%E5%AE%89%E8%A3%85docker" title="Debian11安装docker" "">Debian11安装docker
  • 2、<"http://#debian%209%20stretch%E5%AE%89%E8%A3%85docker" title="debian 9 stretch安装docker" "">debian 9 stretch安装docker
  • 3、<"http://#daemon.json%E6%96%87%E4%BB%B6%E5%A6%82%E4%BD%95%E4%BF%AE%E6%94%B9linux" title="daemon.json文件如何修改linux" "">daemon.json文件如何修改linux
  • 4、<"http://#debian%208%20%E6%80%8E%E4%B9%88%E5%AE%89%E8%A3%85Docker" title="debian 8 怎么安装Docker" "">debian 8 怎么安装Docker
  • 5、<"http://#Docker%E5%AE%B9%E5%99%A8%E4%B8%AD%E5%AE%89%E8%A3%85Docker" title="Docker容器中安装Docker" "">Docker容器中安装Docker

Debian11安装docker

获取加速服务方法

需要将当前用户加入 docker 用户组,否则进行相关操作会提示没有权限,也不建议使用 root 身份来操作docker

至此,docker安装完成。

debian 9 stretch安装docker

1.卸载历史docker

sudo apt-get remove docker docker-engine docker.io

2. 更新apt-get源

sudo apt-get update

3.安装软件包让apt支持HTTPS

sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common

4.添加docker官方GPG KEY

curl -fsSL (. /etc/os-release;echo"$ID")/gpg | sudo apt-key add -

5.指纹验证

sudo apt-key fingerprint 0EBFCD88

是否是:9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88

6.添加apt镜像仓库

x86_64 :

sudo add-apt-repository\"deb [arch=amd64] (. /etc/os-release;echo"$ID")\$(lsb_release -cs)\stable"

armhf :

echo"deb [arch=armhf] (. /etc/os-release;echo"$ID")\$(lsb_release -cs)stable"|\sudo tee /etc/apt/sources.list.d/docker.list

7.安装docker CE(Docker 从 17.03版本之后分为 CE(Community Edition) 和 EE(Enterprise Edition))

sudo apt-get update

sudo apt-get install docker-ce

daemon.json文件如何修改linux

1.如果daemon.json 文件不存在,新建即可。

2/mnt/docker-data 是要指定存放的路径

3.重启Docker服务

4.检查修改结果

查看 Docker Root Dir: 是否是刚刚修改的路径,那么我的Docker数据存放路径已经修改好了。

有问题或意见欢迎留言!

文章知识点与官方知识档案匹配

云原生入门技能树容器(docker)安装docker

9129 人正在系统学习中

打开CSDN APP,看更多技术内容

Linux修改docker默认存储目录_linux修改docker的存储位置_水煮胡萝卜的...

1、先关闭docker: systemctl stop docker 2、创建目的目录: mkdir/root/data 3、复制数据: mv /var/lib/docker /root/docker_data/ 4、修改启动配置文件: vim/lib/systemd/system/docker.service #修改下行后面加上 --graph /root...

继续访问

Docker 修改默认存储路径_u010244957的博客

在linux平台下,docker默认的数据存储位置是:/var/lib/docker。一般的云服务器系统盘都比较小,像docker image这种动辄几百兆的文件,装不了多少就会把系统磁盘空间占满了。所以需要修改docker的数据存储位置,将它存储到其他挂载的数据盘上...

继续访问

最新发布 Linux上如何安全的迁移Docker的数据目录/var/lib/docker

虚拟机创建时,一般分配一个比较小的系统盘,然后挂载一个大容量的数据盘,docker默认情况下数据存储在系统盘(/var/lib/docker)目录,时间一久,会占满系统盘。

继续访问

更改docker存储路径

docker存储满了怎么办,好慌!!!!

继续访问

Linux系统一键安装Docker(并更改Docker的容器默认存储位置)

Linux系统一键安装Docker(并更改Docker的容器默认存储位置)前言一、一键安装命令Ubuntu、Debian、UOS、Deepin、CentOS都一样二、更改默认存储路径总结前言Linux系统Docker的安装非常简单,官方的一键安装命令,无需配置任何东西,如果你的服务器...

继续访问

linux更改默认存储目录,Linux下正确修改Docker镜像和容器的默认存储位置...

我们通过 yum 的方式安装完Docker环境后,它默认的存储位置是 /var/lib/docker,默认的 pid 存放位置是 /var/run/docker.pid。如果仅仅是做测试,我们可能没有必要修改,但是当大量使用docker镜像的时候,我们可能就要默认存储的位置了。...

继续访问

linux修改docker地址,Docker系列06:Linux修改docker镜像和容器数据存储位置

指定镜像和容器存放路径的参数是--graph=/var/lib/docker,其默认存储位置为/var/lib/docker,Docker 的配置文件可以设置大部分的后台进程参数,在各个操作系统中的存放位置不一致,1. 在 Ubuntu 中的位置是:/etc/default/docker,OPTIONS=--graph="/root/data/docker" -H fd://# 或者DOCKER_...

继续访问

Linux修改docker默认存储目录

CentOS和Ubuntu都适用: docker 默认的数据目录是/var/lib/docker,比如要修改到/root/docker_data/下 Ubuntu修改方法: 1、先关闭docker: systemctl stop docker 2、创建目的目录: mkdir /root/data 3、复制数据: mv /var/lib/docker /root/docker_data/ 4、修改启动配置文件: vim /lib/systemd/system/docker.service #修改下.

继续访问

Linux 修改Docker存储路径_XD742971636的博客_linux修改...

在linux平台下,docker默认的数据存储位置是:/var/lib/docker。 一般的云服务器系统盘都比较小,像docker image这种动辄几百兆的文件,装不了多少就会把系统磁盘空间占满了。所以需要修改docker的数据存储位置,将它存储到其他挂载的数据盘上...

继续访问

安装docker及修改Docker数据存储路径_xuewu777777的博客_user...

修改Docker数据存储路径 首先停掉Docker服务: systemctl stop docker或者service docker stop 方法一、如果是centos7: 修改docker.service文件,使用-g参数指定存储位置 vi /usr/lib/systemd/system/docker.service ...

继续访问

Linux系统一键安装Docker(并更改Docker的容器默认存储位置)

Linux系统一键安装Docker(并更改Docker的容器默认存储位置)前言一、一键安装命令Ubuntu、Debian、UOS、Deepin、CentOS都一样二、更改默认存储路径总结 前言 Linux系统Docker的安装非常简单,官方的一键安装命令,无需配置任何东西,如果你的服务器无法联网就只能用麻烦的离线安装了。 就是如果你的服务器的磁盘分了不同区的话,要更改一下 Docker 的容器和镜像的默认存储位置,否则的话默认会安装在/var/lib/docker目录下,日志也会在这个目录生成,慢慢把系统

继续访问

docker:CentOS安装 docker和默认安装目录

Docker支持以下的CentOS版本: CentOS 7 (64-bit) CentOS 6.5 (64-bit)或更高的版本 前提条件 目前,CentOS 仅发行版本中的内核支持 Docker。 Docker 运行在 CentOS 7 上,要求系统为64位、系统内核版本为 3.10 以上。 Docker 运行在CentOS-6.5或更高的版本的 CentOS 上,要求系统为64

debian 8 怎么安装Docker

一般这类软件官网都有FAQ的。还有看官网的user guide

英文安装过程如下:

Debian

Docker is supported on the following versions of Debian:

Debian testing stretch (64-bit)

Debian 8.0 Jessie (64-bit)

Debian 7.7 Wheezy (64-bit) (backports required)

Note: If you previously installed Docker using APT, make sure you update your APT sources to the new APT repository.

Prerequisites

Docker requires a 64-bit installation regardless of your Debian version. Additionally, your kernel must be 3.10 at minimum. The latest 3.10 minor version or a newer maintained version are also acceptable.

Kernels older than 3.10 lack some of the features required to run Docker containers. These older versions are known to have bugs which cause data loss and frequently panic under certain conditions.

To check your current kernel version, open a terminal and use uname -r to display your kernel version:

$ uname -r

Additionally, for users of Debian Wheezy, backports must be available. To enable backports in Wheezy:

Log into your machine and open a terminal with sudo or root privileges.

Open the /etc/apt/sources.list.d/backports.list file in your favorite editor.

If the file doesn’t exist, create it.

Remove any existing entries.

Add an entry for backports on Debian Wheezy.

An example entry:

deb wheezy-backports main

Update package information:

$ apt-get update

Update your apt repository

Docker’s APT repository contains Docker 1.7.1 and higher. To set APT to use from the new repository:

If you haven’t already done so, log into your machine as a user with sudo or root privileges.

Open a terminal window.

Purge any older repositories.

$ apt-get purge "lxc-docker*"

$ apt-get purge "docker.io*"

Update package information, ensure that APT works with the https method, and that CA certificates are installed.

$ apt-get update

$ apt-get install apt-transport-https ca-certificates

Add the new GPG key.

$ apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

Open the /etc/apt/sources.list.d/docker.list file in your favorite editor.

If the file doesn’t exist, create it.

Remove any existing entries.

Add an entry for your Debian operating system.

The possible entries are:

Note: Docker does not provide packages for all architectures. To install docker on a multi-architecture system, add an [arch=...] clause to the entry. Refer to the Debian Multiarch wiki for details.

On Debian Wheezy

deb debian-wheezy main

On Debian Jessie

deb debian-jessie main

On Debian Stretch/Sid

deb debian-stretch main

Save and close the file.

Update the APT package index.

$ apt-get update

Verify that APT is pulling from the right repository.

$ apt-cache policy docker-engine

From now on when you run apt-get upgrade, APT pulls from the new apt repository.

Install Docker

Before installing Docker, make sure you have set your APT repository correctly as described in the prerequisites.

Update the APT package index.

$ sudo apt-get update

Install Docker.

$ sudo apt-get install docker-engine

Start the docker daemon.

$ sudo service docker start

Verify docker is installed correctly.

$ sudo docker run hello-world

This command downloads a test image and runs it in a container. When the container runs, it prints an informational message. Then, it exits.

Giving non-root access

The docker daemon always runs as the root user and the docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user root, and so, by default, you can access it with sudo.

If you (or your Docker installer) create a Unix group called docker and add users to it, then the docker daemon will make the ownership of the Unix socket read/writable by the docker group when the daemon starts. The docker daemon must always run as the root user, but if you run the docker client as a user in thedocker group then you don’t need to add sudo to all the client commands. From Docker 0.9.0 you can use the -G flag to specify an alternative group.

Warning: The docker group (or the group specified with the -G flag) is root-equivalent; see Docker Daemon Attack Surface details.

Example:

# Add the docker group if it doesn't already exist.

$ sudo groupadd docker

# Add the connected user "${USER}" to the docker group.

# Change the user name to match your preferred user.

# You may have to logout and log back in again for

# this to take effect.

$ sudo gpasswd -a ${USER} docker

# Restart the Docker daemon.

$ sudo service docker restart

Upgrade Docker

To install the latest version of Docker with apt-get:

$ apt-get upgrade docker-engine

Uninstall

To uninstall the Docker package:

$ sudo apt-get purge docker-engine

To uninstall the Docker package and dependencies that are no longer needed:

$ sudo apt-get autoremove --purge docker-engine

The above commands will not remove images, containers, volumes, or user created configuration files on your host. If you wish to delete all images, containers, and volumes run the following command:

$ rm -rf /var/lib/docker

You must delete the user created configuration files manually.

如果你用apt 请先更新apt 

docker 支持64位debain .内核最低必须是3.10的。

可以用 uname -r 命令查看系统和内核版本

Docker容器中安装Docker

最近用到Jenkins,使用了Docker来提供服务,但是在构建步骤中又希望能够使用Docker去生成镜像,因此需要实现在Docker容器中去安装Docker,其实也就是在特定的系统环境下安装Docker,但是实际操作中可能还会出现其他问题。

以Jenkins/Jenkins容器为例子。

进入jenkins容器:

一般安装前都需要知道当前系统信息,没有安装lsb-core,因此执行:

我在第一次查询时候也看不出来是用的哪个系统以及版本,猜测应该为Debian。

因为原来的配置的源速度太慢(无效?),因此执行apt-get update都会失败,所以无法去安装新的软件。所以需要先更改源配置,这个过程中我找到了不少配置信息,但是基本都因为key过期等原因不能够使用。这里推荐一个很好的网站,会每隔四小时发布Debian的源地址:

备份Linux的源配置文件:

修改源配置信息(因为没有安装vim,只能通过方式将地址写入文件)

然后安装vim,方便后面查看等操作。

编辑sources.list 文件,配置完整地址。

同样安装lsb-core,安装完成后可以使用lsb_release -a查看系统版本。

接下来就是安装Docker,这里我们已经知道是在Debian环境下安装Docker,可以参考菜鸟的步骤:

【debian安装docker命令】内容来源于网络,若引用不当、侵权,请联系我们修正或者删除!

版权声明

本文仅代表作者观点,不代表米安网络立场。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

热门