#预备软件 sudo apt install apt-transport-https ca-certificates curl software-properties-common #添加docker的源 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" sudo apt update apt-cache policy docker-ce sudo apt install docker-ce sudo systemctl status docker
离线安装 https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/
sudo dpkg -i nvidia-container-toolkit_1.9.0-1_amd64.deb sudo dpkg -i libnvidia-container-tools_1.9.0-1_amd64.deb sudo dpkg -i libnvidia-container1_1.9.0-1_amd64.deb sudo dpkg -i libnvidia-container-tools_1.9.0-1_amd64.deb sudo dpkg -i nvidia-container-toolkit_1.9.0-1_amd64.deb sudo dpkg -i nvidia-docker2_2.10.0-1_all.deb
FROM,指定初始系统
RUN,镜像内执行命令
COPY,镜像内复制
ENV,设置镜像内环境变量
ARG,Dockerfile内的变量
FROM ubuntu:16.04 MAINTAINER kirk RUN apt-get update
在Dockerfile所在路径下,命令为
docker build .
可加参数,-t <镜像标签> -f
Get https://registry-1.docker.io/v2/: authenticationrequire
由于网络代理需要
在/etc/systemd/system/docker.service.d/下添加文件docker-proxy.conf,
[Service] Environment="HTTP_PROXY=http://公司账号:密码@proxy.x.com:8080" Environment="HTTPS_PROXY=http://公司账号:密码@proxy.x.com:8080" Environment="NO_PROXY=localhost,127.0.0.1"
Get https://registry-1.docker.io/v2/: proxyconnect tcp: dial tcp: lookup http: no such host
推断为无法访问docker镜像官网,设置镜像加速器地址,修改文件/etc/docker/daemon.json
{ "registry-mirrors": [ "https://xxx.mirror.x.com" ] }
重启daemon和docker
容器需要代理方可上网,主机上新建或编辑~/.docker/config.json
{ "proxies": { "default": { "httpProxy": "http://账号:密码@proxy.x.com:8080", "httpsProxy": "http://账号:密码@proxy.x.com:8080", "noProxy": "localhost,127.0.0.1" } } }
设置后镜像中apt-get install出现Failed to fetch http...,软件版本问题,改为apt-get install --fix-missing
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \ && curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \ && curl -s -L udo | sudo tee /etc/apt/sources.list.d/nvidia-docker.list sudo apt-get update sudo apt-get install -y nvidia-docker2 #Restart the Docker daemon to complete the installation after setting the default runtime
运行rviz出错libGL error: No matching fbConfigs or visuals found
安装Nvidia驱动
问题:缺少依赖,递归安装解决依赖。
No protocol specified QXcbConnection: Could not connect to display :1 Aborted (core dumped)
需要在主机上执行 xhost +