在 alpine 3.9 上设置 mitmproxy 时出错

Error in setting up mitmproxy on alpine 3.9

我正在使用 alpine 3.9,并在其上设置了 mitmproxy。(https://github.com/danielguerra69/alpine-mitmproxy/blob/master/Dockerfile) 码头文件:

FROM alpine:3.9
RUN apk --update --no-cache add py2-pip ca-certificates gcc libffi-dev python2-dev musl-dev openssl-dev g++ libxml2-dev\
libxslt-dev libjpeg-turbo-dev zlib-dev tshark
RUN pip install --upgrade pip
RUN pip install mitmproxy

低于给定错误:

    Running setup.py install for cryptography ... error
    Complete output from command /usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-FMJgtg/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-nS60bt/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/cryptography
    copying src/cryptography/__about__.py -> build/lib.linux-x86_64-2.7/cryptography
    copying src/cryptography/__init__.py -> build/lib.linux-x86_64-2.7/cryptography
    copying src/cryptography/fernet.py -> build/lib.linux-x86_64-2.7/cryptography
    copying src/cryptography/utils.py -> build/lib.linux-x86_64-2.7/cryptography
    copying src/cryptography/exceptions.py -> build/lib.linux-x86_64-2.7/cryptography
    creating build/lib.linux-x86_64-2.7/cryptography/x509
    copying src/cryptography/x509/oid.py -> build/lib.linux-x86_64-2.7/cryptography/x509
    copying src/cryptography/x509/general_name.py -> build/lib.linux-x86_64-2.7/cryptography/x509
    copying src/cryptography/x509/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/x509
    copying src/cryptography/x509/extensions.py -> build/lib.linux-x86_64-2.7/cryptography/x509
    copying src/cryptography/x509/name.py -> build/lib.linux-x86_64-2.7/cryptography/x509
    copying src/cryptography/x509/base.py -> build/lib.linux-x86_64-2.7/cryptography/x509
    creating build/lib.linux-x86_64-2.7/cryptography/hazmat
    copying src/cryptography/hazmat/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat
    creating build/lib.linux-x86_64-2.7/cryptography/hazmat/bindings
    copying src/cryptography/hazmat/bindings/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/bindings
    creating build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/cmac.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/serialization.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/padding.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/hashes.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/keywrap.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/constant_time.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/hmac.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives
    creating build/lib.linux-x86_64-2.7/cryptography/hazmat/backends
    copying src/cryptography/hazmat/backends/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends
    copying src/cryptography/hazmat/backends/multibackend.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends
    copying src/cryptography/hazmat/backends/interfaces.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends
    creating build/lib.linux-x86_64-2.7/cryptography/hazmat/bindings/openssl
    copying src/cryptography/hazmat/bindings/openssl/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/bindings/openssl
    copying src/cryptography/hazmat/bindings/openssl/binding.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/bindings/openssl
    copying src/cryptography/hazmat/bindings/openssl/_conditional.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/bindings/openssl
    creating build/lib.linux-x86_64-2.7/cryptography/hazmat/bindings/commoncrypto
    copying src/cryptography/hazmat/bindings/commoncrypto/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/bindings/commoncrypto
    copying src/cryptography/hazmat/bindings/commoncrypto/binding.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/bindings/commoncrypto
    creating build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/twofactor
    copying src/cryptography/hazmat/primitives/twofactor/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/twofactor
    copying src/cryptography/hazmat/primitives/twofactor/hotp.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/twofactor
    copying src/cryptography/hazmat/primitives/twofactor/totp.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/twofactor
    copying src/cryptography/hazmat/primitives/twofactor/utils.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/twofactor
    creating build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/kdf
    copying src/cryptography/hazmat/primitives/kdf/pbkdf2.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/kdf
    copying src/cryptography/hazmat/primitives/kdf/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/kdf
    copying src/cryptography/hazmat/primitives/kdf/concatkdf.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/kdf
    copying src/cryptography/hazmat/primitives/kdf/kbkdf.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/kdf
    copying src/cryptography/hazmat/primitives/kdf/x963kdf.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/kdf
    copying src/cryptography/hazmat/primitives/kdf/hkdf.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/kdf
    creating build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/rsa.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/ec.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/padding.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/dh.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/dsa.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/utils.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/asymmetric
    creating build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/ciphers
    copying src/cryptography/hazmat/primitives/ciphers/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/ciphers
    copying src/cryptography/hazmat/primitives/ciphers/modes.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/ciphers
    copying src/cryptography/hazmat/primitives/ciphers/base.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/ciphers
    copying src/cryptography/hazmat/primitives/ciphers/algorithms.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/ciphers
    creating build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/interfaces
    copying src/cryptography/hazmat/primitives/interfaces/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/interfaces
    creating build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/cmac.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/rsa.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/ec.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/x509.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/hashes.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/dsa.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/utils.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/backend.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/hmac.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/decode_asn1.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/encode_asn1.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/ciphers.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl
    creating build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/commoncrypto
    copying src/cryptography/hazmat/backends/commoncrypto/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/commoncrypto
    copying src/cryptography/hazmat/backends/commoncrypto/hashes.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/commoncrypto
    copying src/cryptography/hazmat/backends/commoncrypto/backend.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/commoncrypto
    copying src/cryptography/hazmat/backends/commoncrypto/hmac.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/commoncrypto
    copying src/cryptography/hazmat/backends/commoncrypto/ciphers.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/commoncrypto
    running egg_info
    writing requirements to src/cryptography.egg-info/requires.txt
    writing src/cryptography.egg-info/PKG-INFO
    writing top-level names to src/cryptography.egg-info/top_level.txt
    writing dependency_links to src/cryptography.egg-info/dependency_links.txt
    writing entry points to src/cryptography.egg-info/entry_points.txt
    reading manifest file 'src/cryptography.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    no previously-included directories found matching 'docs/_build'
    warning: no previously-included files matching '*' found under directory 'vectors'
    writing manifest file 'src/cryptography.egg-info/SOURCES.txt'
    running build_ext
    generating cffi module 'build/temp.linux-x86_64-2.7/_padding.c'
    creating build/temp.linux-x86_64-2.7
    generating cffi module 'build/temp.linux-x86_64-2.7/_constant_time.c'
    generating cffi module 'build/temp.linux-x86_64-2.7/_openssl.c'
    building '_openssl' extension
    creating build/temp.linux-x86_64-2.7/build
    creating build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7
    gcc -fno-strict-aliasing -Os -fomit-frame-pointer -g -DNDEBUG -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/_openssl.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/_openssl.o
    build/temp.linux-x86_64-2.7/_openssl.c:718:23: error: conflicting types for 'ASN1_TIME_to_generalizedtime'
     ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *,
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from build/temp.linux-x86_64-2.7/_openssl.c:527:
    /usr/include/openssl/asn1.h:630:23: note: previous declaration of 'ASN1_TIME_to_generalizedtime' was here
     ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(const ASN1_TIME *t,
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c:812:6: error: conflicting types for 'BIO_callback_ctrl'
     long BIO_callback_ctrl(
          ^~~~~~~~~~~~~~~~~
    In file included from /usr/include/openssl/asn1.h:16,
                     from build/temp.linux-x86_64-2.7/_openssl.c:527:
    /usr/include/openssl/bio.h:570:6: note: previous declaration of 'BIO_callback_ctrl' was here
     long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp);
          ^~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c:1029:5: error: conflicting types for 'EVP_PKEY_size'
     int EVP_PKEY_size(EVP_PKEY *);
         ^~~~~~~~~~~~~
    In file included from /usr/include/openssl/cmac.h:19,
                     from build/temp.linux-x86_64-2.7/_openssl.c:537:
    /usr/include/openssl/evp.h:992:5: note: previous declaration of 'EVP_PKEY_size' was here
     int EVP_PKEY_size(const EVP_PKEY *pkey);
         ^~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c:1326:5: error: conflicting types for 'SSL_renegotiate_pending'
     int SSL_renegotiate_pending(SSL *);
         ^~~~~~~~~~~~~~~~~~~~~~~
    In file included from build/temp.linux-x86_64-2.7/_openssl.c:611:
    /usr/include/openssl/ssl.h:1923:12: note: previous declaration of 'SSL_renegotiate_pending' was here
     __owur int SSL_renegotiate_pending(const SSL *s);
                ^~~~~~~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_d_ASN1_STRING_data':
    build/temp.linux-x86_64-2.7/_openssl.c:13455:3: warning: 'ASN1_STRING_data' is deprecated [-Wdeprecated-declarations]
       return ASN1_STRING_data(x0);
       ^~~~~~
    In file included from /usr/include/openssl/e_os2.h:13,
                     from build/temp.linux-x86_64-2.7/_openssl.c:499:
    /usr/include/openssl/asn1.h:554:1: note: declared here
     DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x))
     ^~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_f_ASN1_STRING_data':
    build/temp.linux-x86_64-2.7/_openssl.c:13478:3: warning: 'ASN1_STRING_data' is deprecated [-Wdeprecated-declarations]
       { result = ASN1_STRING_data(x0); }
       ^
    In file included from /usr/include/openssl/e_os2.h:13,
                     from build/temp.linux-x86_64-2.7/_openssl.c:499:
    /usr/include/openssl/asn1.h:554:1: note: declared here
     DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x))
     ^~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_d_BIO_f_buffer':
    build/temp.linux-x86_64-2.7/_openssl.c:14818:10: warning: return discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
       return BIO_f_buffer();
              ^~~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_f_BIO_f_buffer':
    build/temp.linux-x86_64-2.7/_openssl.c:14828:12: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
       { result = BIO_f_buffer(); }
                ^
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_d_BIO_f_null':
    build/temp.linux-x86_64-2.7/_openssl.c:14842:10: warning: return discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
       return BIO_f_null();
              ^~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_f_BIO_f_null':
    build/temp.linux-x86_64-2.7/_openssl.c:14852:12: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
       { result = BIO_f_null(); }
                ^
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_d_BIO_s_fd':
    build/temp.linux-x86_64-2.7/_openssl.c:16271:10: warning: return discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
       return BIO_s_fd();
              ^~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_f_BIO_s_fd':
    build/temp.linux-x86_64-2.7/_openssl.c:16281:12: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
       { result = BIO_s_fd(); }
                ^
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_d_BIO_s_file':
    build/temp.linux-x86_64-2.7/_openssl.c:16295:10: warning: return discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
       return BIO_s_file();
              ^~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_f_BIO_s_file':
    build/temp.linux-x86_64-2.7/_openssl.c:16305:12: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
       { result = BIO_s_file(); }
                ^
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_d_BIO_s_mem':
    build/temp.linux-x86_64-2.7/_openssl.c:16319:10: warning: return discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
       return BIO_s_mem();
              ^~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_f_BIO_s_mem':
    build/temp.linux-x86_64-2.7/_openssl.c:16329:12: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
       { result = BIO_s_mem(); }
                ^
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_d_BIO_s_null':
    build/temp.linux-x86_64-2.7/_openssl.c:16343:10: warning: return discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
       return BIO_s_null();
              ^~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_f_BIO_s_null':
    build/temp.linux-x86_64-2.7/_openssl.c:16353:12: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
       { result = BIO_s_null(); }
                ^
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_d_BIO_s_socket':
    build/temp.linux-x86_64-2.7/_openssl.c:16367:10: warning: return discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
       return BIO_s_socket();
              ^~~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_f_BIO_s_socket':
    build/temp.linux-x86_64-2.7/_openssl.c:16377:12: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
       { result = BIO_s_socket(); }
                ^
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_d_DTLSv1_client_method':
    build/temp.linux-x86_64-2.7/_openssl.c:22849:3: warning: 'DTLSv1_client_method' is deprecated [-Wdeprecated-declarations]
       return DTLSv1_client_method();
       ^~~~~~
    In file included from /usr/include/openssl/e_os2.h:13,
                     from build/temp.linux-x86_64-2.7/_openssl.c:499:
    /usr/include/openssl/ssl.h:1897:1: note: declared here
     DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_client_method(void))
     ^~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_f_DTLSv1_client_method':
    build/temp.linux-x86_64-2.7/_openssl.c:22859:3: warning: 'DTLSv1_client_method' is deprecated [-Wdeprecated-declarations]
       { result = DTLSv1_client_method(); }
       ^
    In file included from /usr/include/openssl/e_os2.h:13,
                     from build/temp.linux-x86_64-2.7/_openssl.c:499:
    /usr/include/openssl/ssl.h:1897:1: note: declared here
     DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_client_method(void))
     ^~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_d_DTLSv1_method':
    build/temp.linux-x86_64-2.7/_openssl.c:22873:3: warning: 'DTLSv1_method' is deprecated [-Wdeprecated-declarations]
       return DTLSv1_method();
       ^~~~~~
    In file included from /usr/include/openssl/e_os2.h:13,
                     from build/temp.linux-x86_64-2.7/_openssl.c:499:
    /usr/include/openssl/ssl.h:1895:1: note: declared here
     DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_method(void)) /* DTLSv1.0 */
     ^~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_f_DTLSv1_method':
    build/temp.linux-x86_64-2.7/_openssl.c:22883:3: warning: 'DTLSv1_method' is deprecated [-Wdeprecated-declarations]
       { result = DTLSv1_method(); }
       ^
    In file included from /usr/include/openssl/e_os2.h:13,
                     from build/temp.linux-x86_64-2.7/_openssl.c:499:
    /usr/include/openssl/ssl.h:1895:1: note: declared here
     DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_method(void)) /* DTLSv1.0 */
     ^~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_d_DTLSv1_server_method':
    build/temp.linux-x86_64-2.7/_openssl.c:22897:3: warning: 'DTLSv1_server_method' is deprecated [-Wdeprecated-declarations]
       return DTLSv1_server_method();
       ^~~~~~
    In file included from /usr/include/openssl/e_os2.h:13,
                     from build/temp.linux-x86_64-2.7/_openssl.c:499:
    /usr/include/openssl/ssl.h:1896:1: note: declared here
     DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_server_method(void))
     ^~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_f_DTLSv1_server_method':
    build/temp.linux-x86_64-2.7/_openssl.c:22907:3: warning: 'DTLSv1_server_method' is deprecated [-Wdeprecated-declarations]
       { result = DTLSv1_server_method(); }
       ^
    In file included from /usr/include/openssl/e_os2.h:13,
                     from build/temp.linux-x86_64-2.7/_openssl.c:499:
    /usr/include/openssl/ssl.h:1896:1: note: declared here
     DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_server_method(void))
     ^~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_d_OPENSSL_config':
    build/temp.linux-x86_64-2.7/_openssl.c:39578:3: warning: 'OPENSSL_config' is deprecated [-Wdeprecated-declarations]
       OPENSSL_config(x0);
       ^~~~~~~~~~~~~~
    In file included from /usr/include/openssl/e_os2.h:13,
                     from build/temp.linux-x86_64-2.7/_openssl.c:499:
    /usr/include/openssl/conf.h:91:1: note: declared here
     DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name))
     ^~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_f_OPENSSL_config':
    build/temp.linux-x86_64-2.7/_openssl.c:39600:3: warning: 'OPENSSL_config' is deprecated [-Wdeprecated-declarations]
       { OPENSSL_config(x0); }
       ^
    In file included from /usr/include/openssl/e_os2.h:13,
                     from build/temp.linux-x86_64-2.7/_openssl.c:499:
    /usr/include/openssl/conf.h:91:1: note: declared here
     DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name))
     ^~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_d_TLSv1_1_client_method':
    build/temp.linux-x86_64-2.7/_openssl.c:52774:3: warning: 'TLSv1_1_client_method' is deprecated [-Wdeprecated-declarations]
       return TLSv1_1_client_method();
       ^~~~~~
    In file included from /usr/include/openssl/e_os2.h:13,
                     from build/temp.linux-x86_64-2.7/_openssl.c:499:
    /usr/include/openssl/ssl.h:1885:1: note: declared here
     DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_client_method(void))
     ^~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_f_TLSv1_1_client_method':
    build/temp.linux-x86_64-2.7/_openssl.c:52784:3: warning: 'TLSv1_1_client_method' is deprecated [-Wdeprecated-declarations]
       { result = TLSv1_1_client_method(); }
       ^
    In file included from /usr/include/openssl/e_os2.h:13,
                     from build/temp.linux-x86_64-2.7/_openssl.c:499:
    /usr/include/openssl/ssl.h:1885:1: note: declared here
     DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_client_method(void))
     ^~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_d_TLSv1_1_method':
    build/temp.linux-x86_64-2.7/_openssl.c:52798:3: warning: 'TLSv1_1_method' is deprecated [-Wdeprecated-declarations]
       return TLSv1_1_method();
       ^~~~~~
    In file included from /usr/include/openssl/e_os2.h:13,
                     from build/temp.linux-x86_64-2.7/_openssl.c:499:
    /usr/include/openssl/ssl.h:1883:1: note: declared here
     DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_method(void)) /* TLSv1.1 */
     ^~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_f_TLSv1_1_method':
    build/temp.linux-x86_64-2.7/_openssl.c:52808:3: warning: 'TLSv1_1_method' is deprecated [-Wdeprecated-declarations]
       { result = TLSv1_1_method(); }
       ^
    In file included from /usr/include/openssl/e_os2.h:13,
                     from build/temp.linux-x86_64-2.7/_openssl.c:499:
    /usr/include/openssl/ssl.h:1883:1: note: declared here
     DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_method(void)) /* TLSv1.1 */
     ^~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_d_TLSv1_1_server_method':
    build/temp.linux-x86_64-2.7/_openssl.c:52822:3: warning: 'TLSv1_1_server_method' is deprecated [-Wdeprecated-declarations]
       return TLSv1_1_server_method();
       ^~~~~~
    In file included from /usr/include/openssl/e_os2.h:13,
                     from build/temp.linux-x86_64-2.7/_openssl.c:499:
    /usr/include/openssl/ssl.h:1884:1: note: declared here
     DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_server_method(void))
     ^~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_f_TLSv1_1_server_method':
    build/temp.linux-x86_64-2.7/_openssl.c:52832:3: warning: 'TLSv1_1_server_method' is deprecated [-Wdeprecated-declarations]
       { result = TLSv1_1_server_method(); }
       ^
    In file included from /usr/include/openssl/e_os2.h:13,
                     from build/temp.linux-x86_64-2.7/_openssl.c:499:
    /usr/include/openssl/ssl.h:1884:1: note: declared here
     DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_server_method(void))
     ^~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_d_TLSv1_2_client_method':
    build/temp.linux-x86_64-2.7/_openssl.c:52846:3: warning: 'TLSv1_2_client_method' is deprecated [-Wdeprecated-declarations]
       return TLSv1_2_client_method();
       ^~~~~~
    In file included from /usr/include/openssl/e_os2.h:13,
                     from build/temp.linux-x86_64-2.7/_openssl.c:499:
    /usr/include/openssl/ssl.h:1891:1: note: declared here
     DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_client_method(void))
     ^~~~~~~~~~~~~~~~~~

    ----------------------------------------

Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-FMJgtg/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install
--record /tmp/pip-record-nS60bt/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-FMJgtg/cryptography/

任何人都可以帮助我理解这一点吗?

解决方案是使用 python3 而不是 python2:

FROM alpine:3.9
RUN apk --update --no-cache add py3-pip ca-certificates gcc libffi-dev python3-dev musl-dev openssl-dev g++ libxml2-dev\
 libxslt-dev libjpeg-turbo-dev zlib-dev tshark
RUN pip3 install --upgrade pip
RUN pip3 install mitmproxy
COPY bin /bin
ENV LANG=en_US.UTF-8
VOLUME /root/.mitmproxy
EXPOSE 8080
CMD ["mitmproxy"]