testcontainers-go: [Bug]: cannot load docker-compose pkg

Testcontainers version

v0.21.0

Using the latest Testcontainers version?

Yes

Host OS

macOS

Host arch

arm64

Go version

1.19

Docker version

Client: Docker Engine - Community
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.17.5
 Git commit:        e91ed5707e
 Built:             Sun Dec 12 06:28:24 2021
 OS/Arch:           darwin/arm64
 Context:           desktop-linux
 Experimental:      true

Server: Docker Desktop 4.20.1 (110738)
 Engine:
  Version:          24.0.2
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.4
  Git commit:       659604f
  Built:            Thu May 25 21:50:59 2023
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.21
  GitCommit:        3dce8eb055cbb6872793272b4f20ed16117344f8
 runc:
  Version:          1.1.7
  GitCommit:        v1.1.7-0-g860f061
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Docker info

Client:
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.10.5)
  compose: Docker Compose (Docker Inc., v2.18.1)
  dev: Docker Dev Environments (Docker Inc., v0.1.0)
  extension: Manages Docker extensions (Docker Inc., v0.2.19)
  init: Creates Docker-related starter files for your project (Docker Inc., v0.1.0-beta.4)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.26.0)
  scout: Command line tool for Docker Scout (Docker Inc., v0.12.0)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 2
 Server Version: 24.0.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3dce8eb055cbb6872793272b4f20ed16117344f8
 runc version: v1.1.7-0-g860f061
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.49-linuxkit-pr
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 5
 Total Memory: 7.765GiB
 Name: docker-desktop
 ID: 332ff111-fabe-4fe9-81e3-bbc9e1ce2f3f
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

What happened?

When I go get github.com/testcontainers/testcontainers-go/modules/compose and run test codes. It fails as https://github.com/Uask-Lab/uask-chain/actions/runs/5435211559/jobs/9884154871?pr=2:

$ go test -v ./test/integration/... 
# go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp
../../go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.29.0/handler.go:50:38: undefined: metric.Int64Counter
../../go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.29.0/handler.go:51:38: undefined: metric.Float64Histogram
../../go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.29.0/handler.go:96:38: undefined: metric.Int64Counter
../../go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.29.0/handler.go:97:44: undefined: metric.Float64Histogram
../../go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.29.0/handler.go:99:38: h.meter.NewInt64Counter undefined (type metric.Meter has no field or method NewInt64Counter)
../../go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.29.0/handler.go:102:39: h.meter.NewInt64Counter undefined (type metric.Meter has no field or method NewInt64Counter)
../../go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.29.0/handler.go:105:39: h.meter.NewFloat64Histogram undefined (type metric.Meter has no field or method NewFloat64Histogram)
../../go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.29.0/config.go:65:25: undefined: global.GetMeterProvider
# github.com/fsnotify/fsevents
cgo-gcc-prolog:452:2: warning: 'FSEventStreamScheduleWithRunLoop' is deprecated: first deprecated in macOS 13.0 - Use FSEventStreamSetDispatchQueue instead. [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/FSEvents.framework/Headers/FSEvents.h:1138:1: note: 'FSEventStreamScheduleWithRunLoop' has been explicitly marked deprecated here
FAIL    uask-chain/test/integration [build failed]
FAIL

You can reproduce this bug in https://github.com/Uask-Lab/uask-chain/, just git clone it and run go test -v ./test/integration/...

Relevant log output

No response

Additional information

I’ve already replace in go.mod as your doc:

replace (
	github.com/cucumber/godog => github.com/laurazard/godog v0.0.0-20220922095256-4c4b17abdae7

	golang.org/x/oauth2 => golang.org/x/oauth2 v0.1.0

	// For k8s dependencies, we use a replace directive, to prevent them being
	// upgraded to the version specified in containerd, which is not relevant to the
	// version needed.
	// See https://github.com/docker/buildx/pull/948 for details.
	// https://github.com/docker/buildx/blob/v0.8.1/go.mod#L62-L64
	k8s.io/api => k8s.io/api v0.22.4
	k8s.io/apimachinery => k8s.io/apimachinery v0.22.4
	k8s.io/client-go => k8s.io/client-go v0.22.4
)

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 19

Most upvoted comments

Fix for me was downgrading containerd from v1.7.5 => v1.7.4:

github.com/containerd/containerd v1.7.4 // indirect

@Lawliet-Chan I’m sorry to hear you gave up. Hopefully reading https://github.com/testcontainers/testcontainers-go/discussions/653 will clarify why this repo is under maintenance until I’m back

thanks @timotheus90 downgrading fixed the issue for me

I’ve seen that same warning, only on my Mac M1. We can probably close this issue and maybe open a new one for the related warning. Wdyt?

Sounds good. Please close this issue

I still get an error related to otel dependencies with the latest version

go: finding module for package github.com/testcontainers/testcontainers-go/modules/compose
go: found github.com/testcontainers/testcontainers-go/modules/compose in github.com/testcontainers/testcontainers-go/modules/compose v0.23.0
go: finding module for package github.com/weppos/publicsuffix-go/publicsuffix
go: finding module for package go.opentelemetry.io/otel/metric/global
go: finding module for package go.opentelemetry.io/otel/metric/instrument
go: found github.com/weppos/publicsuffix-go/publicsuffix in github.com/weppos/publicsuffix-go v0.30.1
go: finding module for package go.opentelemetry.io/otel/metric/instrument
go: finding module for package go.opentelemetry.io/otel/metric/global
fairmoney/gotron/internal/api/v1/integrationtest tested by
        fairmoney/gotron/internal/api/v1/integrationtest.test imports
        github.com/testcontainers/testcontainers-go/modules/compose imports
        github.com/docker/compose/v2/pkg/compose imports
        github.com/moby/buildkit/client imports
        go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc imports
        go.opentelemetry.io/otel/metric/global: module go.opentelemetry.io/otel/metric@latest found (v1.16.0), but does not contain package go.opentelemetry.io/otel/metric/global
fairmoney/gotron/internal/api/v1/integrationtest tested by
        fairmoney/gotron/internal/api/v1/integrationtest.test imports
        github.com/testcontainers/testcontainers-go/modules/compose imports
        github.com/docker/compose/v2/pkg/compose imports
        github.com/moby/buildkit/client imports
        go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc imports
        go.opentelemetry.io/otel/metric/instrument: module go.opentelemetry.io/otel/metric@latest found (v1.16.0), but does not contain package go.opentelemetry.io/otel/metric/instrument

Any updates on this issue? I am facing the same issue.

no, I gave up testcontainers-go