docker_client = <docker.client.DockerClient object at 0xffff8ac66860> application_docker_image_configs = {'dotnet': {'runtime': 'dotnet'}, 'golang': {'runtime': 'golang'}, 'java': {'runtime': 'java'}, 'java_hotspot-jdk-11': {'buildargs': {'JAVA_BASE_IMAGE': 'openjdk:11-jdk'}, 'runtime': 'java'}, ...}, runtime = 'java' application_image_tag = 'musl' @fixture def application_docker_image( docker_client: DockerClient, application_docker_image_configs: Mapping[str, Dict[str, Any]], runtime: str, application_image_tag: str, ) -> Iterable[Image]: if is_aarch64(): if application_image_tag == "j9" or application_image_tag == "zing": pytest.xfail( "Different JVMs are not supported on aarch64, see https://github.com/Granulate/gprofiler/issues/717" ) # if application_image_tag == "musl": # pytest.xfail("musl is not supported on aarch64, see https://github.com/Granulate/gprofiler/issues/714") > yield _build_image(docker_client, **application_docker_image_configs[image_name(runtime, application_image_tag)]) tests/conftest.py:360: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _tests/conftest.py:237: in _build_image return docker_client.images.build(path=str(base_path), rm=True, dockerfile=str(base_path / dockerfile), **kwargs)[0] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <docker.models.images.ImageCollection object at 0xffff8ab5b8b0>, kwargs = {'dockerfile': '/home/ubuntu/gprofiler/tests/containers/java/musl.Dockerfile', 'path': '/home/ubuntu/gprofiler/tests/containers/java', 'rm': True} resp = <generator object APIClient._stream_helper at 0xffff89175bd0>, last_event = {'stream': '\x1b[91mexec /bin/sh: exec format error\n\x1b[0m'}, image_id = 'd49bf8c44670834d3dade17f8b84d709e7db47f1887f671a0e098bafa9bae49f' result_stream = <itertools._tee object at 0xffff8ab40b40>, internal_stream = <itertools._tee object at 0xffff8ab40800> chunk = {'error': "The command '/bin/sh -c javac Fibonacci.java' returned a non-zero code: 1", 'errorDetail': {'code': 1, 'message': "The command '/bin/sh -c javac Fibonacci.java' returned a non-zero code: 1"}}, match = None def build(self, **kwargs): """ Build an image and return it. Similar to the ``docker build`` command. Either ``path`` or ``fileobj`` must be set.
If you have a tar file for the Docker build context (including a
Dockerfile) already, pass a readable file-like object to ``fileobj``
and also pass ``custom_context=True``. If the stream is compressed
also, set ``encoding`` to the correct value (e.g ``gzip``).
If you want to get the raw output of the build, use the
:py:meth:`~docker.api.build.BuildApiMixin.build` method in the
low-level API.
Args:
path (str): Path to the directory containing the Dockerfile
fileobj: A file object to use as the Dockerfile. (Or a file-like
object)
tag (str): A tag to add to the final image
quiet (bool): Whether to return the status
nocache (bool): Don't use the cache when set to ``True`` rm (bool): Remove intermediate containers. The ``docker build``
command now defaults to ``--rm=true``, but we have kept the old default of `False` to preserve backward compatibility
timeout (int): HTTP timeout
custom_context (bool): Optional if using ``fileobj``
encoding (str): The encoding for a stream. Set to ``gzip`` for compressing
pull (bool): Downloads any updates to the FROM image in Dockerfiles
forcerm (bool): Always remove intermediate containers, even after
unsuccessful builds dockerfile (str): path within the build context to the Dockerfile buildargs (dict): A dictionary of build arguments container_limits (dict): A dictionary of limits applied to each
container created by the build process. Valid keys:
- memory (int): set memory limit for build
- memswap (int): Total memory (memory + swap), -1 to disable
swap
- cpushares (int): CPU shares (relative weight)
- cpusetcpus (str): CPUs in which to allow execution, e.g.,
``"0-3"``, ``"0,1"``
shmsize (int): Size of `/dev/shm` in bytes. The size must be
greater than 0. If omitted the system uses 64MB
labels (dict): A dictionary of labels to set on the image
cache_from (list): A list of images used for build cache
resolution
target (str): Name of the build-stage to build in a multi-stage
Dockerfile
network_mode (str): networking mode for the run commands during
build
squash (bool): Squash the resulting images layers into a
single layer.
extra_hosts (dict): Extra hosts to add to /etc/hosts in building
containers, as a mapping of hostname to IP address.
platform (str): Platform in the format ``os[/arch[/variant]]``.
isolation (str): Isolation technology used during build.
Default: `None`.
use_config_proxy (bool): If ``True``, and if the docker client
configuration file (``~/.docker/config.json`` by default)
contains a proxy configuration, the corresponding environment
variables will be set in the container being built.
Returns:
(tuple): The first item is the :py:class:`Image` object for the
image that was build. The second item is a generator of the
build logs as JSON-decoded objects.
Raises:
:py:class:`docker.errors.BuildError`
If there is an error during the build.
:py:class:`docker.errors.APIError`
If the server returns any other error.
``TypeError``
If neither ``path`` nor ``fileobj`` is specified.
"""
resp = self.client.api.build(**kwargs)
if isinstance(resp, six.string_types):
return self.get(resp)
last_event = None
image_id = None
result_stream, internal_stream = itertools.tee(json_stream(resp))
for chunk in internal_stream:
if 'error' in chunk:
> raise BuildError(chunk['error'], result_stream)
E docker.errors.BuildError: The command '/bin/sh -c javac Fibonacci.java' returned a non-zero code: 1
/usr/local/lib/python3.10/dist-packages/docker/models/images.py:287: BuildError
============================================================================================================================== warnings summary ===============================================================================================================================test_java.py: 75 warnings
/usr/local/lib/python3.10/dist-packages/docker/utils/utils.py:52: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
s1 = StrictVersion(v1)
test_java.py: 75 warnings
/usr/local/lib/python3.10/dist-packages/docker/utils/utils.py:53: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
s2 = StrictVersion(v2)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================================================================================================================== short test summary info ===========================================================================================================================
ERROR tests/test_java.py::test_java_async_profiler_musl_and_cpu[musl-True] - docker.errors.BuildError: The command '/bin/sh -c javac Fibonacci.java' returned a non-zero code: 1