I'm attempting to build a very simple docker image with PyArmor installed for use in a CI/CD job. The docker build is able to install PyArmor with pip, but fails during the pyarmor register step. Per the docs i've tried adding a host for pyarmor.dashingsoft.com:119.23.58.77 using the Docker --add-host command, but it made no difference.
Dockerfile:
FROM python:3.9
RUN python3 -m pip install build
ADD pyarmor-regcode-3423.txt .
RUN python3 -m pip install pyarmor
RUN pyarmor -d register pyarmor-regcode-3423.txt
ENTRYPOINT [ "pyarmor", "--version"]
Command run:
docker build --add-host=pyarmor.dashingsoft.com:119.23.58.77 -t build_image:0.1 .
Output:
...
=> ERROR [5/6] RUN pyarmor -d register pyarmor-regcode-3423.txt 1.3s
------
> [5/6] RUN pyarmor -d register pyarmor-regcode-3423.txt:
#8 0.365 INFO PyArmor Trial Version 7.7.4
#8 0.365 INFO Python 3.9.16
#8 0.365 INFO Read registration code file: pyarmor-regcode-3423.txt
#8 0.366 DEBUG Got registration code: xxxxxxxxxxxxxxxxxxxx
#8 0.367 INFO Start to activate this code
#8 1.213 Traceback (most recent call last):
#8 1.213 File "/usr/local/lib/python3.9/urllib/request.py", line 1346, in do_open
#8 1.213 h.request(req.get_method(), req.selector, req.data, headers,
#8 1.213 File "/usr/local/lib/python3.9/http/client.py", line 1285, in request
#8 1.214 self._send_request(method, url, body, headers, encode_chunked)
#8 1.214 File "/usr/local/lib/python3.9/http/client.py", line 1331, in _send_request
#8 1.215 self.endheaders(body, encode_chunked=encode_chunked)
#8 1.215 File "/usr/local/lib/python3.9/http/client.py", line 1280, in endheaders
#8 1.216 self._send_output(message_body, encode_chunked=encode_chunked)
#8 1.216 File "/usr/local/lib/python3.9/http/client.py", line 1040, in _send_output
#8 1.216 self.send(msg)
#8 1.216 File "/usr/local/lib/python3.9/http/client.py", line 980, in send
#8 1.217 self.connect()
#8 1.217 File "/usr/local/lib/python3.9/http/client.py", line 1454, in connect
#8 1.217 self.sock = self._context.wrap_socket(self.sock,
#8 1.217 File "/usr/local/lib/python3.9/ssl.py", line 501, in wrap_socket
#8 1.218 return self.sslsocket_class._create(
#8 1.218 File "/usr/local/lib/python3.9/ssl.py", line 1041, in _create
#8 1.218 self.do_handshake()
#8 1.218 File "/usr/local/lib/python3.9/ssl.py", line 1310, in do_handshake
#8 1.219 self._sslobj.do_handshake()
#8 1.219 ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)
#8 1.219
#8 1.219 During handling of the above exception, another exception occurred:
#8 1.219
#8 1.219 Traceback (most recent call last):
#8 1.219 File "/usr/local/lib/python3.9/site-packages/pyarmor/utils.py", line 1685, in _urlopen
#8 1.220 return urlopen(*args, **kwargs)
#8 1.220 File "/usr/local/lib/python3.9/urllib/request.py", line 214, in urlopen
#8 1.220 return opener.open(url, data, timeout)
#8 1.220 File "/usr/local/lib/python3.9/urllib/request.py", line 517, in open
#8 1.220 response = self._open(req, data)
#8 1.220 File "/usr/local/lib/python3.9/urllib/request.py", line 534, in _open
#8 1.221 result = self._call_chain(self.handle_open, protocol, protocol +
#8 1.221 File "/usr/local/lib/python3.9/urllib/request.py", line 494, in _call_chain
#8 1.221 result = func(*args)
#8 1.222 File "/usr/local/lib/python3.9/urllib/request.py", line 1389, in https_open
#8 1.222 return self.do_open(http.client.HTTPSConnection, req,
#8 1.222 File "/usr/local/lib/python3.9/urllib/request.py", line 1349, in do_open
#8 1.223 raise URLError(err)
#8 1.223 urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)>
#8 1.223
#8 1.223 During handling of the above exception, another exception occurred:
#8 1.223
#8 1.223 Traceback (most recent call last):
#8 1.223 File "/usr/local/lib/python3.9/urllib/request.py", line 1346, in do_open
#8 1.223 h.request(req.get_method(), req.selector, req.data, headers,
#8 1.223 File "/usr/local/lib/python3.9/http/client.py", line 1285, in request
#8 1.224 self._send_request(method, url, body, headers, encode_chunked)
#8 1.224 File "/usr/local/lib/python3.9/http/client.py", line 1331, in _send_request
#8 1.224 self.endheaders(body, encode_chunked=encode_chunked)
#8 1.224 File "/usr/local/lib/python3.9/http/client.py", line 1280, in endheaders
#8 1.225 self._send_output(message_body, encode_chunked=encode_chunked)
#8 1.225 File "/usr/local/lib/python3.9/http/client.py", line 1040, in _send_output
#8 1.225 self.send(msg)
#8 1.225 File "/usr/local/lib/python3.9/http/client.py", line 980, in send
#8 1.225 self.connect()
#8 1.225 File "/usr/local/lib/python3.9/http/client.py", line 1447, in connect
#8 1.226 super().connect()
#8 1.226 File "/usr/local/lib/python3.9/http/client.py", line 946, in connect
#8 1.226 self.sock = self._create_connection(
#8 1.226 File "/usr/local/lib/python3.9/socket.py", line 823, in create_connection
#8 1.227 for res in getaddrinfo(host, port, 0, SOCK_STREAM):
#8 1.227 File "/usr/local/lib/python3.9/socket.py", line 954, in getaddrinfo
#8 1.227 for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
#8 1.227 socket.gaierror: [Errno -2] Name or service not known
#8 1.227
#8 1.227 During handling of the above exception, another exception occurred:
#8 1.227
#8 1.227 Traceback (most recent call last):
#8 1.227 File "/usr/local/bin/pyarmor", line 8, in <module>
#8 1.227 sys.exit(main_entry())
#8 1.227 File "/usr/local/lib/python3.9/site-packages/pyarmor/pyarmor.py", line 1612, in main_entry
#8 1.227 main(sys.argv[1:])
#8 1.227 File "/usr/local/lib/python3.9/site-packages/pyarmor/pyarmor.py", line 1604, in main
#8 1.228 args.func(args)
#8 1.228 File "/usr/local/lib/python3.9/site-packages/pyarmor/pyarmor.py", line 866, in _register
#8 1.228 filename = activate_regcode(ucode)
#8 1.228 File "/usr/local/lib/python3.9/site-packages/pyarmor/register.py", line 74, in activate_regcode
#8 1.228 res = _urlopen(reg_url % ucode, timeout=6.0)
#8 1.228 File "/usr/local/lib/python3.9/site-packages/pyarmor/utils.py", line 1689, in _urlopen
#8 1.229 return urlopen(*args, **kwargs)
#8 1.229 File "/usr/local/lib/python3.9/urllib/request.py", line 214, in urlopen
#8 1.229 return opener.open(url, data, timeout)
#8 1.229 File "/usr/local/lib/python3.9/urllib/request.py", line 523, in open
#8 1.229 response = meth(req, response)
#8 1.229 File "/usr/local/lib/python3.9/urllib/request.py", line 632, in http_response
#8 1.230 response = self.parent.error(
#8 1.230 File "/usr/local/lib/python3.9/urllib/request.py", line 555, in error
#8 1.230 result = self._call_chain(*args)
#8 1.230 File "/usr/local/lib/python3.9/urllib/request.py", line 494, in _call_chain
#8 1.230 result = func(*args)
#8 1.230 File "/usr/local/lib/python3.9/urllib/request.py", line 747, in http_error_302
#8 1.230 return self.parent.open(new, timeout=req.timeout)
#8 1.230 File "/usr/local/lib/python3.9/urllib/request.py", line 517, in open
#8 1.231 response = self._open(req, data)
#8 1.231 File "/usr/local/lib/python3.9/urllib/request.py", line 534, in _open
#8 1.231 result = self._call_chain(self.handle_open, protocol, protocol +
#8 1.231 File "/usr/local/lib/python3.9/urllib/request.py", line 494, in _call_chain
#8 1.231 result = func(*args)
#8 1.231 File "/usr/local/lib/python3.9/urllib/request.py", line 1389, in https_open
#8 1.232 return self.do_open(http.client.HTTPSConnection, req,
#8 1.232 File "/usr/local/lib/python3.9/urllib/request.py", line 1349, in do_open
#8 1.233 raise URLError(err)
#8 1.233 urllib.error.URLError: <urlopen error [Errno -2] Name or service not known>
------
executor failed running [/bin/sh -c pyarmor -d register pyarmor-regcode-3423.txt]: exit code: 1
bug