linux - Docker 构建错误,存档/tar : sockets not supported

标签 linux docker dockerfile

我是 Docker 的新手,正在尝试构建镜像。 我使用 Docker commit 命令成功地做到了这一点,但是当我尝试使用 Dockerfile 做到这一点时,我得到了这个错误:

shim@shim-Inspiron-5570:~$ sudo docker build -t shim/debian .
[sudo] password for shim: 
ERRO[0014] Can't add file /home/shim/.ServiceHub/bc1be858c1/116f2fb4b7 to tar: archive/tar: sockets not supported 
ERRO[0014] Can't add file /home/shim/.ServiceHub/bc1be858c1/11a6628921 to tar: archive/tar: sockets not supported 
ERRO[0014] Can't add file /home/shim/.ServiceHub/bc1be858c1/2cb20241cd to tar: archive/tar: sockets not supported 
ERRO[0014] Can't add file /home/shim/.ServiceHub/bc1be858c1/4964606154 to tar: archive/tar: sockets not supported 
ERRO[0014] Can't add file /home/shim/.ServiceHub/bc1be858c1/bc1be858c1 to tar: archive/tar: sockets not supported 
^Cnding build context to Docker daemon  1.725GB

Docker 文件如下所示:

FROM debian:shim
RUN apt-get update
RUN apt-get install -y git
RUN apt-get install -y vim

我使用的是 Ubuntu DeskTop 18.04 有人可以帮助我吗?

最佳答案

看起来你的 Dockerfile 可能在 /home/shim/ 中?

当您执行 docker build . 时,docker 会压缩当前目录的内容并将其发送到 docker 守护进程。看起来/home/shim/.ServiceHub中的一些文件实际上是套接字,所以这个操作失败了。

最佳做法是将 Dockerfile 放在它自己的、隔离的目录中,以避免出现此类情况。

此外,我建议通读 dockerfile_best-practices ,特别是关于 RUNapt-get

的部分

关于linux - Docker 构建错误,存档/tar : sockets not supported,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56215440/

相关文章:

linux - 如何让 linux 在通过 dd 删除磁盘后重新加载设备映射器?

ruby-on-rails - 非 ruby​​ 站点上的 ruby​​ 错误

java - 如何让 Java 从 Gnome 的当前目录执行 jar?

docker - 无法从主机连接到 cassandra

linux - Dockerfile 中的 setfacl 没有效果

python urllib2 发布数据

linux - "bash: sysctl: command not found"在 debian :stretch-slim

python - 在 docker 图像中使用 transformers 包时出现问题

postgresql - 如何解决空 docker-entrypoint-initdb.d 的问题? (PostgresQL + docker )