Docker中的Python urllib.urlretrieve()错误

时间:2018-09-28 11:23:07

标签: python docker

我最近开发了一个Python脚本,可以在Python中从Open-I检索医学图像。该脚本在本地工作,但是现在我已将此脚本放入Docker容器中,当我尝试检索映像时脚本错误。控制台中的输出仅显示:error。有人可以告诉我我做错了什么吗?

import urllib
urllib.urlretrieve('https://openi.nlm.nih.gov/'+record['imgLarge'], path+str(filename))

Docker撰写文件:

version: '3.2'
services:
  zookeeper:
    image: wurstmeister/zookeeper
    ports:
      - "2181:2181"
    tty: true
    networks:
      - retriever
  kafka:
    image: wurstmeister/kafka:latest
    ports:
      - target: 9094
        published: 9094
        protocol: tcp
        mode: host
    environment:
      HOSTNAME_COMMAND: "docker info | grep ^Name: | cut -d' ' -f 2"
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_ADVERTISED_HOST_NAME: kafka
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT
      KAFKA_ADVERTISED_LISTENERS: INSIDE://:9092,OUTSIDE://_{HOSTNAME_COMMAND}:9094
      KAFKA_LISTENERS: INSIDE://:9092,OUTSIDE://:9094
      KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
      KAFKA_CREATE_TOPICS: "rontgen_images"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      - retriever
    tty: true
  python:
    build:
      context: .
      dockerfile: DockerfilePython
    tty: true
    networks:
      - retriever
networks:
  retriever:
    driver: bridge

0 个答案:

没有答案