Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: v0.27.0 breaks bind mounts #2179

Closed
srabraham opened this issue Jan 31, 2024 · 9 comments · Fixed by #2190
Closed

[Bug]: v0.27.0 breaks bind mounts #2179

srabraham opened this issue Jan 31, 2024 · 9 comments · Fixed by #2190
Labels
bug An issue with the library

Comments

@srabraham
Copy link
Contributor

srabraham commented Jan 31, 2024

tl;dr: Please see this demo, which you can clone and run at 0.26.0 and 0.27.0. There's documentation in the main.go
https://github.com/srabraham/demobindmount/blob/main/main.go

Testcontainers version

0.27.0

Using the latest Testcontainers version?

Yes

Host OS

OSX

Host arch

arm64

Go version

1.21

Docker version

Client:
 Cloud integration: v1.0.35+desktop.5
 Version:           24.0.7
 API version:       1.43
 Go version:        go1.20.10
 Git commit:        afdd53b
 Built:             Thu Oct 26 09:04:20 2023
 OS/Arch:           darwin/arm64
 Context:           desktop-linux

Server: Docker Desktop 4.26.1 (131620)
 Engine:
  Version:          24.0.7
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.10
  Git commit:       311b9ff
  Built:            Thu Oct 26 09:08:15 2023
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.25
  GitCommit:        d8f198a4ed8892c764191ef7b3b06d8a2eeb5c7f
 runc:
  Version:          1.1.10
  GitCommit:        v1.1.10-0-g18a0cb0
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Docker info

Client:
 Version:    24.0.7
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.12.0-desktop.2
    Path:     /Users/sean/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.23.3-desktop.2
    Path:     /Users/sean/.docker/cli-plugins/docker-compose
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     /Users/sean/.docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.21
    Path:     /Users/sean/.docker/cli-plugins/docker-extension
  feedback: Provide feedback, right in your terminal! (Docker Inc.)
    Version:  0.1
    Path:     /Users/sean/.docker/cli-plugins/docker-feedback
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.10
    Path:     /Users/sean/.docker/cli-plugins/docker-init
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     /Users/sean/.docker/cli-plugins/docker-sbom
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     /Users/sean/.docker/cli-plugins/docker-scan
  scout: Docker Scout (Docker Inc.)
    Version:  v1.2.0
    Path:     /Users/sean/.docker/cli-plugins/docker-scout

Server:
 Containers: 44
  Running: 19
  Paused: 0
  Stopped: 25
 Images: 176
 Server Version: 24.0.7
 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: d8f198a4ed8892c764191ef7b3b06d8a2eeb5c7f
 runc version: v1.1.10-0-g18a0cb0
 init version: de40ad0
 Security Options:
  seccomp
   Profile: unconfined
  cgroupns
 Kernel Version: 6.5.11-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 8
 Total Memory: 7.76GiB
 Name: docker-desktop
 ID: 51a06b2f-b553-482a-9f12-4962f9735417
 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
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: daemon is not using the default seccomp profile

What happened?

Please see this demo, which you can check out and run at 0.26.0 and 0.27.0. There's documentation in the main.go
https://github.com/srabraham/demobindmount/blob/main/main.go

Relevant log output

No response

Additional information

No response

@srabraham srabraham added the bug An issue with the library label Jan 31, 2024
@srabraham
Copy link
Contributor Author

FYI @mdelapenya

@Bablzz
Copy link
Contributor

Bablzz commented Feb 1, 2024

@srabraham Hi! I hope you are doing well!
check this #1907 and maybe it's good idea use workaround that notice in that PR

@srabraham
Copy link
Contributor Author

srabraham commented Feb 1, 2024

Hi @Bablzz, I've already worked around the problem in my own project by switching to volumes, but the point here is that something broke bind mounts between 0.26.0 and 0.27.0, and that wasn't intentional on the part of the testcontainers-go maintainers. #2163

@mdelapenya
Copy link
Collaborator

I've bisected the code between v0.27 and v0.26, and effectively, this commit is the culprit: 555cb76, so #1907 caused the regression not doing the deprecation correctly.

I'm going to inspect that changeset and submit a fix ASAP.

Thanks for the report!

@mdelapenya
Copy link
Collaborator

More on this: using the HostConfigModifier works, so you still have a workaround. In your repro project you can add this to the ContainerRequest:

	HostConfigModifier: func(hc *container.HostConfig) {
		hc.Binds = []string{mountFile + ":" + containerDir}
	},

This narrows down the issue to the BindMount type, so I'm continuing with the debug in that direction. Will update here my results.

@mdelapenya
Copy link
Collaborator

Ahhh it was easy!! In https://github.com/testcontainers/testcontainers-go/pull/1907/files#diff-f8dd512f57a3d3bc890983ea0164e44d1aa69034527ccf41217f0f2807a76917L6 I'm removing the deprecated type from the list, which should not be done until the type is removed, my bad 🤦

Submitting a fix now.

@srabraham
Copy link
Contributor Author

Ahhh, good find! Thanks for the speedy service!

@mdelapenya
Copy link
Collaborator

Would you mind giving a second try to the repro steps using the above PR? 🙏 A review will be appreciated too

@srabraham
Copy link
Contributor Author

Verified! I commented on the PR too. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue with the library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants