Docker-compose无法卸载软件包

时间:2019-06-10 14:31:57

标签: docker pip docker-compose dockerfile

以下是问题的一个示例:

Dockerfile:

FROM python:3.6.3

RUN pip install apache-airflow[crypto,celery,postgres,hive,jdbc]=1.9.0

COPY requirements.txt /
RUN pip install -r /requirements.txt

requirementx.txt:

pytz==2017.3

当我运行docker-compose -f test.yml build时,它将继续安装apache-airflow及其检测到的依赖库列表。这种情况下的此类库之一是pytz-2019.1。当它到达行pip install -r /requirements.txt时,它检测到已经安装了版本2019.1,因此它将继续进行并尝试将其删除,这是在我遇到以下错误时:

  Found existing installation: pytz 2019.1
    Uninstalling pytz-2019.1:
ERROR: Could not install packages due to an EnvironmentError: [Errno 39] Directory not empty: '/usr/local/lib/python3.6/site-packages/pytz-2019.1.dist-info/'

ERROR: Service 'flower' failed to build: The command '/bin/sh -c pip install -r /requirements.txt' returned a non-zero code: 1

到目前为止,我已经解决的方法是将pip install -r /requirements.txt行移到pip install apache-airflow行上方,这样就无需卸载任何库。我想知道为什么卸载不起作用?这只是问题的简化版本,但实际上,任何需要卸载的步骤均不起作用。

更多信息: -以root用户身份运行 -码头工人信息输出:

Containers: 6
 Running: 6
 Paused: 0
 Stopped: 0
Images: 131
Server Version: 17.12.1-ce
Storage Driver: overlay
 Backing Filesystem: xfs
 Supports d_type: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local local-persist
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: active
 NodeID: yheeakrhdoo3ep5mku3vbhnpl
 Is Manager: true
 ClusterID: sqaigfmafaxut9ulddldcz1o0
 Managers: 1
 Nodes: 1
 Orchestration:
  Task History Retention Limit: 5
 Raft:
  Snapshot Interval: 10000
  Number of Old Snapshots to Retain: 0
  Heartbeat Tick: 1
  Election Tick: 3
 Dispatcher:
  Heartbeat Period: 5 seconds
 CA Configuration:
  Expiry Duration: 3 months
  Force Rotate: 0
 Autolock Managers: false
 Root Rotation In Progress: false
 Node Address: xx.xxx.xx.xx
 Manager Addresses:
  xx.xxx.xxx.xx:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9b55aab90508bd389d7654c4baf173a981477d55
runc version: 9f9c96235cc97674e935002fc3d78361b696a69e
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 3.10.0-229.el7.x86_64
Operating System: Red Hat Enterprise Linux Server 7.5 (Maipo)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.641GiB
Name: xxxx
ID: xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx
Docker Root Dir: /opt/docker/var-lib
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: overlay: the backing xfs filesystem is formatted without d_type support, which leads to incorrect behavior.
         Reformat the filesystem with ftype=1 to enable d_type support.
         Running without d_type support will not be supported in future releases.
WARNING: bridge-nf-call-ip6tables is disabled

我用xxx代替了一些信息。

任何帮助将不胜感激。

谢谢, -K

0 个答案:

没有答案
相关问题