pulumi / pulumi-docker

A Docker Pulumi resource package, providing multi-language access to Docker resources and building images.
84 stars 14 forks source link

warning: #1 [internal] load build definition from Dockerfile #289

Closed XBeg9 closed 1 year ago

XBeg9 commented 3 years ago

@pulumi/docker with new docker.Image generates tons of output with the warning statement: warning: pulumi/pulumi#1 [internal] load build definition from Dockerfile Any ideas on how I can suppress this? and don't miss any other warning?

agucova commented 3 years ago

Totally agree. A flag for disabling the warning would be great. Our workflow includes local development with Docker, so it's much easier for us to work building directly from the Dockerfile.

lukehoban commented 3 years ago

Specifically - this program:

import * as docker from "@pulumi/docker";
const image = new docker.Image("nginx", { imageName: "nginx", build: "./app" });
export const imageName = image.imageName;

And ./app/Dockerfile:

FROM nginx

I see this output:

$ pulumi up
Previewing update (dev)

View Live: https://app.pulumi.com/lukehoban/tdocker/dev/previews/75f28f97-287d-4f5b-b5c3-3cad20d72ab9

     Type                   Name         Plan       Info
 +   pulumi:pulumi:Stack    tdocker-dev  create     
 +   └─ docker:image:Image  nginx        create     1 warning

Diagnostics:
  docker:image:Image (nginx):
    warning: #1 [internal] load build definition from Dockerfile
    #1 sha256:d76d2359560b1746cf4903d8b11c4a9839c083b29c977f2e7528514b3fcd5f02
    #1 transferring dockerfile: 36B done
    #1 DONE 0.0s

    #2 [internal] load .dockerignore
    #2 sha256:ec932c7cc3cb9f88bd30a1836e35e0f9e108b9f12fe2df115f1078f92e44500f
    #2 transferring context: 2B done
    #2 DONE 0.0s

    #3 [internal] load metadata for docker.io/library/nginx:latest
    #3 sha256:06c466a4eb6821b81bd3e48610e5f38dab858b1e9acb01d6e2f6b11c8fabe6bc
    #3 DONE 0.0s

    #4 [1/1] FROM docker.io/library/nginx
    #4 sha256:62549b609c62be5d4a072c8b1697ba6e0f40e59bf6b340565f5132922031518b
    #4 CACHED

    #5 exporting to image
    #5 sha256:e8c613e07b0b7ff33893b694f7759a10d42e180f2b4dc349fb57dc6b71dcab00
    #5 exporting layers done
    #5 writing image sha256:2a72caafba65f57dafa86161487c79ba45853a6c8ca3e210e60c3da6bab8b7bf done
    #5 naming to docker.io/library/nginx done
    #5 DONE 0.0s

    Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them

This is not at all intentional - the Docker CLI must have made a change that is breaking the processing of output from the @pulumi/docker package.

I see the above issues on:

$ docker version
Client:
 Cloud integration: 1.0.14
 Version:           20.10.6
 API version:       1.41
 Go version:        go1.16.3
 Git commit:        370c289
 Built:             Fri Apr  9 22:46:57 2021
 OS/Arch:           darwin/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.6
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       8728dd2
  Built:            Fri Apr  9 22:44:56 2021
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
lukehoban commented 3 years ago

Ahh - indeed - this is now the default docker build output from the Docker CLI (in non-interactive mode) as of Docker Desktop 3.20 (https://docs.docker.com/docker-for-mac/release-notes/#docker-desktop-320). It is a shame that this is so much worse that the previous output from docker build - I'm not immediately sure what should be presented to users here.

mattotodd commented 2 years ago

the --quiet flag suppresses that output

image = docker.Image(f'docker_image',
  build=docker.DockerBuild(
    context='./path/to/code/',
    extra_options=[ '--quiet']
  ),
  image_name=image_name,
  registry=registry_info
)
AaronFriel commented 1 year ago

This issue should be resolved with the new implementation of the Docker Image resource in v4! See our blog post for more info: https://www.pulumi.com/blog/build-images-50x-faster-docker-v4/