Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
191 views
in Technique[技术] by (71.8m points)

linux - When I install using python image in docker, if my docker directory is installed on another hard disk, it will fail when executing pip-install

pip version

20.3.3

Python version

python:3.9.1

OS

Linux

Dockerfile:

FROM python:3.9.1
COPY --from=openjdk:11 /usr/local/openjdk-11 /usr/local/openjdk-11

RUN pip config set global.index-url https://pypi.doubanio.com/simple/
&& pip config set global.trusted-host pypi.doubanio.com
&& pip install Mako requests pymatgen apscheduler
ENV JAVA_HOME=/usr/local/openjdk-11
ENV PATH=${JAVA_HOME}/bin:$PATH
RUN java --version

docker info

?> ~/storage docker info 10:03:46

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)

Server:
Containers: 16
Running: 3
Paused: 0
Stopped: 13
Images: 40
Server Version: 20.10.3
Storage Driver: aufs
Root Dir: /home/matcloudplus/storage/docker/lib/aufs
Backing Filesystem: nfs
Dirs: 110
Dirperm1 Supported: true
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: 269548fa27e0089a8b8278fc4fc781d7f65a939b
runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.15.0-135-generic
Operating System: Ubuntu 18.04.5 LTS
OSType: linux
Architecture: x86_64
CPUs: 64
Total Memory: 125.9GiB
Name: iZ8vbgfaf2ya4gtguw9w0cZ
ID: JPSR:2ODB:X3IU:5UX3:2HUB:2Q3W:G3V3:2L5K:6MHF:3MCY:Y53N:UZMT
Docker Root Dir: /home/matcloudplus/storage/docker/lib
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://6xnlqfhs.mirror.aliyuncs.com/
Live Restore Enabled: false

WARNING: No swap limit support
WARNING: the aufs storage-driver is deprecated, and will be removed in a future release.

Description

I installed docker in the system to build an image with both java and python3 environment. On other machines, such operations and building images are all successful. However, I found that the hard disk space in my linux system is insufficient, so I created a new directory and used

sudo mount -t nfs -o vers=3,nolock,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2, noresvport /dev/vdb1 /home/matcloudplus/storage/ Mount the hard disk Loaded to my /home/matcloudplus/storage/ directory, and used the /home/matcloudplus/storage/docker/lib directory under this directory to replace the original /var/lib/docker, the following is my daemon.json content

{
"graph": "/home/matcloudplus/storage/docker/lib",
"registry-mirrors": ["https://6xnlqfhs.mirror.aliyuncs.com"]
}

Everything seems to be normal. However, when I build the image on this server, it fails all the time. When I execute the RUN command in the above dockerfile, it fails. When I cancel the mount of the hard disk and restart the docker, it just fails. The build can be successful, which makes me very puzzled. I mounted the NAS hard drive of the ALiYun service provider. When this happens, I don’t know whether to ask docker, python, pip, or aliyun, so I can only Post it again, I can’t solve this problem. The image I use requires that my hard disk occupancy rate not be higher than 75%, and my own physical machine has already exceeded this threshold. I must use a new hard disk, but this problem I can't solve it

Expected behavior

When the hard disk is not mounted,Normally build, the image is successfully built,log:

   Collecting tabulate
      Downloading https://pypi.doubanio.com/packages/c4/f4/770ae9385990f5a19a91431163d262182d3203662ea2b5739d0fcfc080f1/tabulate-0.8.7-py3-none-any.whl (24 kB)
    Building wheels for collected packages: Mako, pymatgen, retrying, future, mpmath
      Building wheel for Mako (setup.py): started
      Building wheel for Mako (setup.py): finished with status 'done'
      Created wheel for Mako: filename=Mako-1.1.4-py2.py3-none-any.whl size=75675 sha256=65b71013508748308ac6795ce732c697388739cb9ad90217d13dee87e47a31f2
      Stored in directory: /root/.cache/pip/wheels/59/4e/c7/9fab27cd9efbe0dbb72e7e155d1ccf96d5931c736eda76cd0d
      Building wheel for pymatgen (setup.py): started
      Building wheel for pymatgen (setup.py): finished with status 'done'
      Created wheel for pymatgen: filename=pymatgen-2020.12.31-cp39-cp39-linux_x86_64.whl size=3946314 sha256=2bca8de80e6d129150c469ec62ca89a16a6aec89163be47a04bbfd364554452c
      Stored in directory: /root/.cache/pip/wheels/59/75/87/d05efc208d74bce8a0368eebca2b7ba743f8add4c0ef46aa15
      Building wheel for retrying (setup.py): started
      Building wheel for retrying (setup.py): finished with status 'done'
      Created wheel for retrying: filename=retrying-1.3.3-py3-none-any.whl size=11429 sha256=f73b6fae347f496e483274ef684d39b01d0e7b7509a248119e6d7a5b0a81ad8a
      Stored in directory: /root/.cache/pip/wheels/96/4f/f9/49a8cf51d87d8eed926bdcd198468532fdf4e97d71cbadaa0d
      Building wheel for future (setup.py): started
      Building wheel for future (setup.py): finished with status 'done'
      Created wheel for future: filename=future-0.18.2-py3-none-any.whl size=491059 sha256=7ee0e3e98c43aa36e843e3eca94a3760efb5500cc2dda66fd63a233a704005ce
      Stored in directory: /root/.cache/pip/wheels/31/fb/97/91bc10cc2d76a2a525e0716f4ae611f74f6b8ca977aba9bebb
      Building wheel for mpmath (setup.py): started
      Building wheel for mpmath (setup.py): finished with status 'done'
      Created wheel for mpmath: filename=mpmath-1.1.0-py3-none-any.whl size=532239 sha256=ff74e68dccfa4fea248fb7279eac281af476fc5463c296437a126e113bbd35f1
      Stored in directory: /root/.cache/pip/wheels/fe/8a/3e/0f28f6c7965cfb700cb048787ab4a8fb82f6660b6332e0feb8
    Successfully built Mako pymatgen retrying future mpmath
    Installing collected packages: six, urllib3, retrying, pytz, python-dateutil, pyparsing, pillow, numpy, mpmath, kiwisolver, idna, future, decorator, cycler, chardet, certifi, uncertainties, tzlocal, tabulate, sympy, spglib, scipy, ruamel.yaml, requests, plotly, pandas, palettable, networkx, monty, matplotlib, MarkupSafe, pymatgen, Mako, apscheduler
    Successfully installed Mako-1.1.4 MarkupSafe-1.1.1 apscheduler-3.7.0 certifi-2020.12.5 chardet-4.0.0 cycler-0.10.0 decorator-4.4.2 future-0.18.2 idna-2.10 kiwisolver-1.3.1 matplotlib-3.3.4 monty-4.0.2 mpmath-1.1.0 networkx-2.5 numpy-1.20.0 palettable-3.3.0 pandas-1.2.1 pillow-8.1.0 plotly-4.14.3 pymatgen-2020.12.31 pyparsing-2.4.7 python-dateutil-2.8.1 pytz-2021.1 requests-2.25.1 retrying-1.3.3 ruamel.yaml-0.16.12 scipy-1.6.0 six-1.15.0 spglib-1.16.1 sympy-1.7.1 tabulate-0.8.7 tzlocal-2.1 uncertainties-3.1.5 urllib3-1.26.3
    WARNING: You are using pip version 20.3.3; however, version 21.0.1 is available.
    You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
    Removing intermediate container 380de1ed68d3
     ---> 32f9302b1fd7
    Step 4/6 : ENV JAVA_HOME=/usr/local/openjdk-11
     ---> Running in 4abf3207a04d
    Removing intermediate container 4abf3207a04d
     ---> c70e2887ef66
    Step 5/6 : ENV PATH=${JAVA_HOME}/bin:$PATH
     ---> Running in 044967fbf774
    Removing intermediate container 044967fbf774
     ---> 60657ed0dc1c
    Step 6/6 : RUN java --version
     ---> Running in 7f702a5f4068
    openjdk 11.0.9.1 2020-11-04
    OpenJDK Runtime Environment 18.9 (build 11.0.9.1+1)
    OpenJDK 64-Bit Server VM 18.9 (build 11.0.9.1+1, mixed mode)
    Removing intermediate container 7f702a5f4068
     ---> 332449747adb
    
    Successfully built 332449747adb

How to Reproduce

  1. Install docker
  2. Build the image without mounting the hard disk-----success
  3. Close docker
  4. Mount the hard drive
  5. Edit daemon.json or configure docker's root dir path by editing sudo vim /lib/systemd/system/docker.service
  6. Restart docker, build the image ---- failed during pipi install

Mount a new hard disk to a directory on the host server where docker is located, configure the root directory of docker in daemon.json, pay attention to use df -h to check whether the mount is successful, and then use the dockerfile I provided to build

Failed log

 copying build/lib/past/types/olddict.py -> build/bdist.linux-x86_64/wheel/past/types
  copying build/lib/past/types/oldstr.py -> build/bdist.linux-x86_64/wheel/past/types
  creating build/bdist.linux-x86_64/wheel/past/utils
  copying build/lib/past/utils/__init__.py -> build/bdist.linux-x86_64/wheel/past/utils
  running install_egg_info
  Copying src/future.egg-info to build/bdist.linux-x86_64/wheel/future-0.18.2-py3.9.egg-info
  running install_scripts
  error: [Errno 39] Directory not empty: 'build/bdist.linux-x86_64/wheel/future-0.18.2-py3.9.egg-info'
  ----------------------------------------
  ERROR: Failed building wheel for future
  Running setup.py clean for future
  Building wheel for mpmath (setup.py): started
  Building wheel for mpmath (setup.py): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-la7pwtyg/mpmath_cb46a0d0b3b34439b0f615d573ce8497/setup.py'"'"'; __file__='"'"'/tmp/pip-install-la7pwtyg/mpmath_cb46a0d0b3b34439b0f615d573ce8497/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-tmkv5wvf
......
  copying build/lib/mpmath/visualization.py -> build/bdist.linux-x86_64/wheel/mpmath
  running install_egg_info
  running egg_info
  creating mpmath.egg-info
  writing mpmath.egg-info/PKG-INFO
  writing dependency_links to mpmath.egg-info/dependency_links.txt
  writing top-level names to mpmath.egg-info/top_level.txt
  writing manifest file 'mpmath.egg-info/SOURCES.txt'
  reading manifest file 'mpmath.egg-info/SOURCES.txt'
  writing manifest file 'mpmath.egg-info/SOURCES.txt'
  Copying mpmath.egg-info to build/bdist.linux-x86_64/wheel/mpmath-1.1.0-py3.9.egg-info
  running install_scripts
  adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
  error: [Errno 39] Directory not empty: 'build/bdist.linux-x86_64/wheel/mpmath-1.1.0-py3.9.egg-info'
  ----------------------------------------
  ERROR: Failed building wheel for mpmath
  Running setup.py clean for mpmath
Successfully built Mako
Failed to build pymatgen retrying future mpmath
Installing collected packages: six, urllib3, retrying, pytz, python-dateutil, pyparsing, pillow, numpy, mpmath, kiwisolver, idna, future, decorator, cycler, chardet, certifi, uncertainties, tzlocal, tabulate, sympy, spglib, scipy, ruamel.yaml, requests, plotly, pandas, palettable, networkx, monty, matplotlib, MarkupSafe, pymatgen, Mako, apscheduler
    Running setup.py install for retrying: started
    Running setup.py install for retrying: finished with status 'done'
  DEPRECATION:

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...