Testcontainers is a Golang library that providing a friendly API to run Docker container. It is designed to create runtime environment to use during your automatic tests.

Overview

Main pipeline Go Report Card GoDoc Reference

When I was working on a Zipkin PR I discovered a nice Java library called Testcontainers.

It provides an easy and clean API over the go docker sdk to run, terminate and connect to containers in your tests.

I found myself comfortable programmatically writing the containers I need to run an integration/smoke tests. So I started porting this library in Go.

This is an example:

package main

import (
	"context"
	"fmt"
	"net/http"
	"testing"

	"github.com/testcontainers/testcontainers-go"
	"github.com/testcontainers/testcontainers-go/wait"
)

func TestNginxLatestReturn(t *testing.T) {
	ctx := context.Background()
	req := testcontainers.ContainerRequest{
		Image:        "nginx",
		ExposedPorts: []string{"80/tcp"},
		WaitingFor:   wait.ForHTTP("/"),
	}
	nginxC, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
		ContainerRequest: req,
		Started:          true,
	})
	if err != nil {
		t.Error(err)
	}
	defer nginxC.Terminate(ctx)
	ip, err := nginxC.Host(ctx)
	if err != nil {
		t.Error(err)
	}
	port, err := nginxC.MappedPort(ctx, "80")
	if err != nil {
		t.Error(err)
	}
	resp, err := http.Get(fmt.Sprintf("http://%s:%s", ip, port.Port()))
	if resp.StatusCode != http.StatusOK {
		t.Errorf("Expected status code %d. Got %d.", http.StatusOK, resp.StatusCode)
	}
}

This is a simple example, you can create one container in my case using the nginx image. You can get its IP ip, err := nginxC.GetContainerIpAddress(ctx) and you can use it to make a GET: resp, err := http.Get(fmt.Sprintf("http://%s", ip))

To clean your environment you can defer the container termination defer nginxC.Terminate(ctx, t). t is *testing.T and it is used to notify is the defer failed marking the test as failed.

Documentation

The documentation lives in ./docs and it is rendered at golang.testcontainers.org.

Issues
  • (#25) Create very basic implementation of Local Docker Compose

    (#25) Create very basic implementation of Local Docker Compose

    What is this PR doing?

    This is the very beginning of an initiative to port the Docker-Compose approach from the Java implementation to Golang.

    It simply creates the Local Docker Compose approach (no socat container at this moment), which forces developers to have the docker-compose binary in PATH.

    Following Java's approach, a LocalDockerCompose (LDC) object needs to be created with an array of paths to docker-compose.yml files, and an identifier (maybe this second field could be internally created).

    It's possible to configure the LDC with a command (i.e. "up -d"), which will be executed after the method Invoke is called.

    We have added a convenient Down() method, to be executed after tests run to destroy resources created by docker-compose.

    Besides that, we are parsing Docker Compose YAML file to capture service names, and put into an array, so that it's possible to perform operations over the services in the compose file, accessing the compose.Services field.

    Why is it important?

    This will allow developers to configure more elaborated setups for testing, like an Elasticsearch + Kibana, or Metricbeat + MySQL, as an example, being those services coordinated and scheduled by Docker Compose under the hood, with no need to orchestrate them on the programatic side.

    On the other hand, using declarative way of describing services is more familiar to developers (🤞), so the entry barrier could be lower.

    How to test it?

    I added a few unit tests, which verify that there are no errors after executing the compose, checking that environment variables are properly propagated from compose to the containers, and destroying it in a deferred manner.

    Related Issues

    Closes #25

    type/feature 
    opened by mdelapenya 29
  • "go get" failure parsing go.mod file

    I have an implicit dependency on this project and when I run go get -u, I get this error:

    go: github.com/testcontainers/[email protected]: parsing go.mod: unexpected module path "github.com/testcontainers/testcontainers-go"
    
    opened by vangent 17
  • Updating the go version for local Travis build and set wait strategy for compose services

    Updating the go version for local Travis build and set wait strategy for compose services

    With the older version of go within the local docker container, I found this issue: https://github.com/testcontainers/testcontainers-go/issues/260

    I'm updating the docs to fix it.

    opened by shashank-g172 16
  • Runtime panic

    Runtime panic

    Describe the bug Trying to run a test results in a panic when trying to get mapped ports.

    To Reproduce https://github.com/todanni/account/blob/main/internal/repository/repository_test.go

    Expected behavior Not panic.

    ** docker info ** output of the command:

    Client:
     Context:    default
     Debug Mode: false
     Plugins:
      app: Docker App (Docker Inc., v0.9.1-beta3)
      buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
      scan: Docker Scan (Docker Inc., v0.5.0)
    
    Server:
     Containers: 6
      Running: 0
      Paused: 0
      Stopped: 6
     Images: 7
     Server Version: 20.10.5
     Storage Driver: overlay2
      Backing Filesystem: extfs
      Supports d_type: true
      Native Overlay Diff: true
     Logging Driver: json-file
     Cgroup Driver: cgroupfs
     Cgroup Version: 1
     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 io.containerd.runtime.v1.linux runc
     Default Runtime: runc
     Init Binary: docker-init
     containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b
     runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
     init version: de40ad0
     Security Options:
      seccomp
       Profile: default
     Kernel Version: 5.4.72-microsoft-standard-WSL2
     Operating System: Docker Desktop
     OSType: linux
     Architecture: x86_64
     CPUs: 16
     Total Memory: 25.01GiB
     Name: docker-desktop
     ID: K2UZ:4XFZ:UKRM:UXYT:MSZF:OGA3:QDVU:GVOR:EYU5:54DD:Q3J4:KSCK
     Docker Root Dir: /var/lib/docker
     Debug Mode: false
     Registry: https://index.docker.io/v1/
     Labels:
     Experimental: false
     Insecure Registries:
      127.0.0.0/8
     Live Restore Enabled: false
    
    WARNING: No blkio throttle.read_bps_device support
    WARNING: No blkio throttle.write_bps_device support
    WARNING: No blkio throttle.read_iops_device support
    WARNING: No blkio throttle.write_iops_device support
    

    Additional context Output from running go test

    ❯ go test
    2021/03/16 13:17:45 Starting container id: dd41a0e8a506 image: quay.io/testcontainers/ryuk:0.2.3
    2021/03/16 13:17:46 Waiting for container id dd41a0e8a506 image: quay.io/testcontainers/ryuk:0.2.3
    --- FAIL: TestRunAuthenticationTestSuite (0.28s)
        suite.go:63: test panicked: runtime error: index out of range [0] with length 0
            goroutine 6 [running]:
            runtime/debug.Stack(0xc00014e218, 0xc99160, 0xc000128c60)
                    /usr/local/go/src/runtime/debug/stack.go:24 +0x9f
            github.com/stretchr/testify/suite.failOnPanic(0xc0001ce780)
                    /home/dannipo/go/pkg/mod/github.com/stretchr/[email protected]/suite/suite.go:63 +0x5b
            panic(0xc99160, 0xc000128c60)
                    /usr/local/go/src/runtime/panic.go:965 +0x1b9
            github.com/testcontainers/testcontainers-go.(*DockerContainer).MappedPort(0xc00045e100, 0xddd700, 0xc0005244e0, 0xcede63, 0x8, 0x0, 0x0, 0x3132303200000000, 0x63)
                    /home/dannipo/go/pkg/mod/github.com/testcontainers/[email protected]/docker.go:133 +0x485
            github.com/testcontainers/testcontainers-go/wait.(*HostPortStrategy).WaitUntilReady(0xc00011c600, 0xddd6c8, 0xc0005244e0, 0xddd9a0, 0xc00045e100, 0x0, 0x0)
                    /home/dannipo/go/pkg/mod/github.com/testcontainers/[email protected]/wait/host_port.go:59 +0x16f
            github.com/testcontainers/testcontainers-go.(*DockerContainer).Start(0xc00045e100, 0xddd6c8, 0xc0000360d0, 0x0, 0x0)
                    /home/dannipo/go/pkg/mod/github.com/testcontainers/[email protected]/docker.go:165 +0x315
            github.com/testcontainers/testcontainers-go.(*DockerProvider).RunContainer(0xc0005060f0, 0xddd6c8, 0xc0000360d0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xd00532, ...)
                    /home/dannipo/go/pkg/mod/github.com/testcontainers/[email protected]/docker.go:727 +0xeb
            github.com/testcontainers/testcontainers-go.NewReaper(0xddd6c8, 0xc0000360d0, 0xc000152180, 0x24, 0xdcd3a0, 0xc0005060f0, 0x0, 0x0, 0x0, 0x0, ...)
                    /home/dannipo/go/pkg/mod/github.com/testcontainers/[email protected]/reaper.go:78 +0x455
            github.com/testcontainers/testcontainers-go.(*DockerProvider).CreateContainer(0xc0005060f0, 0xddd6c8, 0xc0000360d0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcee503, ...)
                    /home/dannipo/go/pkg/mod/github.com/testcontainers/[email protected]/docker.go:534 +0x18c8
            github.com/testcontainers/testcontainers-go.GenericContainer(0xddd6c8, 0xc0000360d0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcee503, 0x8, ...)
                    /home/dannipo/go/pkg/mod/github.com/testcontainers/[email protected]/generic.go:43 +0xb5
            github.com/todanni/authentication/test/container.NewPGContainer(0xcf23fe, 0xf, 0xcea328, 0xcea318, 0xc0000bfd88)
                    /mnt/c/Projects/todanni/authentication/test/container/postgres.go:41 +0x3db
            github.com/todanni/authentication/internal/repository.(*AccountRepoTestSuite).SetupSuite(0xc0004385a0)
                    /mnt/c/Projects/todanni/authentication/internal/repository/repository_test.go:55 +0x48
            github.com/stretchr/testify/suite.Run(0xc0001ce780, 0xdd4880, 0xc0004385a0)
                    /home/dannipo/go/pkg/mod/github.com/stretchr/[email protected]/suite/suite.go:118 +0x5c7
            github.com/todanni/authentication/internal/repository.TestRunAuthenticationTestSuite(0xc0001ce780)
                    /mnt/c/Projects/todanni/authentication/internal/repository/repository_test.go:25 +0x51
            testing.tRunner(0xc0001ce780, 0xd1bd78)
                    /usr/local/go/src/testing/testing.go:1194 +0xef
            created by testing.(*T).Run
                    /usr/local/go/src/testing/testing.go:1239 +0x2b3
    FAIL
    exit status 1
    FAIL    github.com/todanni/authentication/internal/repository   0.287s
    
    opened by danni-popova 14
  • "not enough arguments in call to p.client.ContainerCreate"

    Installing Testcontainers v0.9.0 currently fails to work, because Go is automatically pulling in Docker v20.10.1 instead of v17.12.0 and the API has changed.

    As such, when I run anything I get:

    /Users/sazzer/.gvm/pkgsets/go1.15.6/global/pkg/mod/github.com/testcontainers/[email protected]/docker.go:645:39: not enough arguments in call to p.client.ContainerCreate
    	have (context.Context, *container.Config, *container.HostConfig, *network.NetworkingConfig, string)
    	want (context.Context, *container.Config, *container.HostConfig, *network.NetworkingConfig, *v1.Platform, string)
    

    I can fix this by running:

    $ go mod edit -require github.com/docker/[email protected]+incompatible
    

    But the next time I run go get -u ./... to update dependencies then it all breaks again.

    opened by sazzer 14
  • Added CopyFileFromContainer to DockerContainer

    Added CopyFileFromContainer to DockerContainer

    Why ?

    While working on a k3s-container I needed to extract the kubeconfig from the running container and discovered that there is no CopyFileFromContainer available.

    What ?

    Added CopyFileFromContainer to DockerContainer. Added Unit-test for the new Function.

    opened by codepitbull 14
  • Upgrading to go1.15 results in a breaking error

    Upgrading to go1.15 results in a breaking error

    Describe the bug Running the package after upgrading to go1.15 causes failure in container creation with this error: failed to create container: creating reaper failed: could not start container: host port waiting failed: error during connect: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.40/exec/4518d0eb0fbb7a35e6917e015ce8300646d703ad809453be8f500b64113f25a9/start": net/http: HTTP/1.x transport connection broken: unsupported transfer encoding: "identity"

    To Reproduce Not sure that I can.

    Expected behavior Not to have this error

    ** docker info ** output of the command:

    $ docker info
    

    Additional context Add any other context about the problem here.

    type/bug 
    opened by rkuprov 12
  • BuildKit to build from Dockerfile/oci

    BuildKit to build from Dockerfile/oci

    Writing testcontainers in Go is fascinating because we have a lot of opportunities to reuse and embed codes to write robust new features.

    testcontainers-java supports an ImageFromDockerfile features that help you to build an image from a Dockerfile in this way you can test your application already containerized.

    I think we can do something even better designing a test-friendly API using buildkit

    opened by gianarb 11
  • Added the ability to build from a Dockerfile

    Added the ability to build from a Dockerfile

    Fixes #57

    Added the ability to build from a Dockerfile, used an embedded struct called FromDockerfile as part of the ContainerRequest struct.

    If you specify a Context, it will use that to build the image. It will not allow you to specify both a Context and an Image

    Added to README with an example.

    type/feature 
    opened by ClaytonNorthey92 10
  • Ensuring compilation for windows, darwin, and linux

    Ensuring compilation for windows, darwin, and linux

    Prior, our dependencies wouldn't allow us to compile for windows:

    $ GOOS=windows go build
    # github.com/docker/docker/pkg/system
    ../../../go/pkg/mod/github.com/docker/[email protected]+incompatible/pkg/system/filesys_windows.go:111:24: cannot use uintptr(unsafe.Pointer(&sd[0])) (type uintptr) as type *"golang.org/x/sys/windows".SECURITY_DESCRIPTOR in assignment
    

    This is solved in the v20.10.2 version.

    I added CI steps to build on the following operating systems: Linux, Windows, and MacOS

    I am explicitly only running tests on Linux, as a lot of the containers we use in tests are only valid Linux containers, and won't run on Windows Server.

    This should be a good start to allow us to update our tests in the near future.

    opened by ClaytonNorthey92 10
  • fix: Following Container Logs feature fixes

    fix: Following Container Logs feature fixes

    • fix the doc: c.FollowOutput() MUST be called before c.StartLogProducer() due to date race
    • do not allow multiple c.StartLogProducer() without calling a c.StopLogProducer()
    • run c.StopLogProducer() in c.Terminate() to reduce risk of an accidental goroutine leak
    • fix tests, write new tests
    opened by slsyy 0
  • Docker container Logs prints stream format for each log line

    Docker container Logs prints stream format for each log line

    Describe the bug

    Printing the logs from a container, the output includes 8 bytes of stream format information at the beginning of each line.

    https://github.com/moby/moby/issues/8223 https://docs.docker.com/engine/api/v1.26/#operation/ContainerAttach

    Current Output:

    ������7Status. booting: 0, online: 4, dying: 0, new_online: 0
    

    To Reproduce

    func TestDockerLogsOutput(t *testing.T) {
    	ctx := context.Background()
    	req := ContainerRequest{
    		Image:      "alpine:latest",
    		Cmd:        []string{"sh", "-c", "id -u"},
    		WaitingFor: wait.ForExit(),
    	}
    	container, err := GenericContainer(ctx, GenericContainerRequest{
    		ContainerRequest: req,
    		Started:          true,
    	})
    	if err != nil {
    		t.Fatal(err)
    	}
    	defer container.Terminate(ctx)
    	r, err := container.Logs(ctx)
    	if err != nil {
    		t.Fatal(err)
    	}
    	defer r.Close()
    	b, err := ioutil.ReadAll(r)
    	if err != nil {
    		t.Fatal(err)
    	}
    	assert.Equal(t, "0", string(b))
    }
    

    Output:

    === RUN   TestDockerLogsOutput
    
    ...
    
            	Error Trace:	docker_test.go:1668
            	Error:      	Not equal:
            	            	expected: "0"
            	            	actual  : "\x01\x00\x00\x00\x00\x00\x00\x020\n"
    
            	            	Diff:
            	            	--- Expected
            	            	+++ Actual
            	            	@@ -1 +1,2 @@
            	            	-0
            	            	+        	            	+
            	Test:       	TestDockerLogsOutput
    --- FAIL: TestDockerLogsOutput (0.98s)
    FAIL
    FAIL	github.com/testcontainers/testcontainers-go	1.781s
    

    Expected behavior

    Expected Output:

    Status. booting: 0, online: 4, dying: 0, new_online: 0
    

    This can be solved by making TTY configurable through a new TTY field in the ContainerRequeststruct.

    opened by bamsammich 0
  • chore(deps): bump github.com/docker/docker from 20.10.8+incompatible to 20.10.9+incompatible

    chore(deps): bump github.com/docker/docker from 20.10.8+incompatible to 20.10.9+incompatible

    Bumps github.com/docker/docker from 20.10.8+incompatible to 20.10.9+incompatible.

    Release notes

    Sourced from github.com/docker/docker's releases.

    v20.10.9

    This release is a security release with security fixes in the CLI, runtime, as well as updated versions of the containerd.io package and the Go runtime.

    Client

    • CVE-2021-41092 Ensure default auth config has address field set, to prevent credentials being sent to the default registry.

    Runtime

    • CVE-2021-41089 Create parent directories inside a chroot during docker cp to prevent a specially crafted container from changing permissions of existing files in the host’s filesystem.
    • CVE-2021-41091 Lock down file permissions to prevent unprivileged users from discovering and executing programs in /var/lib/docker.

    Packaging

    • Update Golang runtime to Go 1.16.8, which contains fixes for CVE-2021-36221 and CVE-2021-39293
    • Update static binaries and containerd.io rpm and deb packages to containerd v1.4.11 and runc v1.0.2 to address CVE-2021-41103.
    • Update the bundled buildx version to v0.6.3 for rpm and deb packages.
    Commits
    • 79ea9d3 Merge pull request #5 from moby/20.10_bump_go_1.16.8
    • fa78afe Update Go to 1.16.8
    • bce32e5 Merge pull request #4 from moby/20.10-ghsa-v994-f8vw-g7j4-chroot-mkdir
    • f0ab919 Merge pull request #2 from moby/20.10-GHSA-3fwx-pjgw-3558_0701-perms
    • 80f1169 chrootarchive: don't create parent dirs outside of chroot
    • 93ac040 Lock down docker root dir perms.
    • d24c6dc Merge pull request #42721 from thaJeztah/20.10_backport_bump_go_1.16.7
    • decb56a Update Go to 1.16.7
    • See full diff in compare view

    Dependabot compatibility score

    You can trigger a rebase of this PR by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Allow uid:gid to be specified during container creation

    Allow uid:gid to be specified during container creation

    Fixes #361

    Adds a User field to ContainerRequest and includes that value in the container config so that uid[:gid] can be specified for the container.

    opened by bamsammich 2
  • Expose configuration of logger

    Expose configuration of logger

    Allow the log instance to be configured independently from other uses of the log package.

    testcontainers.Logger.SetPrefix("[some-prefix] ")
    testcontainers.Logger.SetOutput(io.Discard)
    

    This is still global & it would be better to be able to pass in an instance of *log.Logger but that can be a follow-up PR. I wanted to land something small & hopefully non-contentious.

    opened by rcrowe 2
  • Allow user and group ID specification in ContainerRequest

    Allow user and group ID specification in ContainerRequest

    A ContainerRequest doesn't provide support for setting uid:gid. I have a need to ensure my image will function properly when given an arbitrary UID. The Docker container API package already provides support for this and it should be a small change to make this possible.

    docker.go:

    dockerInput := &container.Config{
      Entrypoint:   req.Entrypoint,
      Image:        tag,
      Env:          env,
      ExposedPorts: exposedPortSet,
      Labels:       req.Labels,
      Cmd:          req.Cmd,
      Hostname:     req.Hostname,
    + User:         req.User,
    }
    

    container.go:

    type ContainerRequest struct {
    	FromDockerfile
    	Image           string
    	Entrypoint      []string
    	Env             map[string]string
    	ExposedPorts    []string // allow specifying protocol info
    	Cmd             []string
    	Labels          map[string]string
    	BindMounts      map[string]string
    	VolumeMounts    map[string]string
    	Tmpfs           map[string]string
    	RegistryCred    string
    	WaitingFor      wait.Strategy
    	Name            string // for specifying container name
    	Hostname        string
    	Privileged      bool                // for starting privileged container
    	Networks        []string            // for specifying network names
    	NetworkAliases  map[string][]string // for specifying network aliases
    +       User            string              // for specifying uid:gid
    	SkipReaper      bool                // indicates whether we skip setting up a reaper for this
    	ReaperImage     string              // alternative reaper image
    	AutoRemove      bool                // if set to true, the container will be removed from the host when stopped
    	NetworkMode     container.NetworkMode
    	AlwaysPullImage bool // Always pull image
    }
    
    opened by bamsammich 2
  • fix: don't panic at an unexpected log type

    fix: don't panic at an unexpected log type

    sometimes docker returns logType = 3 which is an undocumented log type, so treat it as stdout

    fix #359

    opened by Vladimir-Rom 1
  • panic: received invalid log type: 3

    panic: received invalid log type: 3

    Describe the bug Sometimes the StartLogProducer goroutine panics with message "received invalid log type: 3"

    panic: received invalid log type: 3

    goroutine 31 [running]: github.com/testcontainers/testcontainers-go.(*DockerContainer).StartLogProducer.func1(0x30eb040, 0xc00012a010, 0xc000d5e000) /home/builder/go/pkg/mod/github.com/testcontainers/[email protected]/docker.go:397 +0x75f created by github.com/testcontainers/testcontainers-go.(*DockerContainer).StartLogProducer /home/builder/go/pkg/mod/github.com/testcontainers/[email protected]/docker.go:346 +0x53

    To Reproduce It is a race condition which is reproduced not often. Sometimes tests just fail with the panic message. In our scenario tests fail when we receive logs from the official CockroachDB container

    Expected behavior Don't panic

    ** docker info ** output of the command:

    $ docker info
    

    Client: Context: default Debug Mode: false Plugins: app: Docker App (Docker Inc., v0.9.1-beta3) buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)

    Server: Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 0 Server Version: 20.10.3 Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Native Overlay Diff: true Logging Driver: json-file Cgroup Driver: cgroupfs Cgroup Version: 1 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 io.containerd.runtime.v1.linux runc Default Runtime: runc Init Binary: docker-init containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff init version: de40ad0 Security Options: apparmor seccomp Profile: default Kernel Version: 4.15.0-124-generic Operating System: Ubuntu 18.04.5 LTS OSType: linux Architecture: x86_64 CPUs: 4 Total Memory: 15.39GiB Name: ub1804-x64-0032 ID: NF4V:EUCG:VPA6:V2UA:7IZC:P6VO:XGPG:MAZA:OHYQ:TYPI:NGLJ:AUNF Docker Root Dir: /var/lib/docker Debug Mode: false Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries: osmp-docker.artifacts.avp.ru 127.0.0.0/8 Live Restore Enabled: false

    opened by Vladimir-Rom 0
  • Close docker provider client on container terminate

    Close docker provider client on container terminate

    If provider client is not closed it leaks goroutines.

    opened by anjmao 3
  • Update github.com/opencontainers/runc dependencies.

    Update github.com/opencontainers/runc dependencies.

    Describe the bug Currently, testcontainers-go depends on old runc versions. Unfortunately on May 25th, a high severity issue was discovered CVE-2021-30465

    https://github.com/advisories/GHSA-c3xm-pvg7-gh7r

    opened by xxbtwxx 2
Releases(v0.11.1)
  • v0.11.1(Jun 24, 2021)

    What's Changed

    🐛 Bug Fixes

    • fix(compose): filter containers by service name only (#330) @mdelapenya

    📖 Documentation

    • Fix misspelling (#328) @msal4
    Source code(tar.gz)
    Source code(zip)
  • v0.11.0(Jun 1, 2021)

    What's Changed

    • Retry follow logs request on closed connection (#323) @rmfitzpatrick
    • Add instrumentations for containers created with Dockerfile (#311) @xicoalmeida
    • close reaper go routines on DockerContainer.Terminate & DockerNetwork.Remove (#320) @Eun
    • Wait strategies must poll ports (#295) @programminh

    🚀 Features

    • feat: add wait-for support for compose (#308) @mdelapenya

    🐛 Bug Fixes

    • Fix/wait log exact number occurences (#298) @FlorianLehmann

    📦 Dependency updates

    • Upgrade to GitHub-native Dependabot (#316) @dependabot-preview
    • build(deps): bump github.com/docker/docker from 20.10.5+incompatible to 20.10.6+incompatible (#309) @dependabot-preview
    • build(deps): bump github.com/Microsoft/hcsshim from 0.8.15 to 0.8.16 (#307) @dependabot-preview
    • build(deps): bump github.com/go-sql-driver/mysql from 1.5.0 to 1.6.0 (#305) @dependabot-preview
    • Bump jinja2 from 2.11.2 to 2.11.3 (#296) @dependabot
    Source code(tar.gz)
    Source code(zip)
  • v0.10.0(Mar 12, 2021)

    What's Changed

    • Ensuring compilation for windows, darwin, and linux (#270) @ClaytonNorthey92
    • Remove Travis (#287) @gianarb
    • Fix typos (#281) @sashayakovtseva
    • Update Docker dependency to Docker 20.10.3. (#283) @michielboekhoff
    • feat: add logging on image pull error (#272) @tobiaszheller
    • chore: add GH action badge (#265) @mdelapenya
    • Remove gin dependency (#262) @colega
    • feature: move to github action #242 (#257) @Bablzz
    • Fix: comment log strategy (#256) @Bablzz
    • fix: fixed typos (#254) @Bablzz
    • Resolving issue #248 (#249) @ikolomiyets

    📖 Documentation

    • Document our approach to modules (#268) @gianarb
    • docs: fix variable type (#266) @mdelapenya

    🧹 Housekeeping

    • Add a GH action stage to send coverage reports to Codecov (#264) @mdelapenya
    • chore: support removing orphan containers when destroying the compose (#267) @mdelapenya
    • Fix shellcheck issues (#251) @Bablzz

    📦 Dependency updates

    • Bump github.com/Microsoft/hcsshim from 0.8.14 to 0.8.15 (#292) @dependabot-preview
    • Bump github.com/docker/docker from 20.10.4+incompatible to 20.10.5+incompatible (#291) @dependabot-preview
    • Bump github.com/docker/docker from 20.10.3+incompatible to 20.10.4+incompatible (#290) @dependabot-preview
    • Bump github.com/Microsoft/hcsshim from 0.8.7 to 0.8.14 (#288) @dependabot-preview
    • Bump github.com/google/uuid from 1.1.4 to 1.2.0 (#289) @dependabot-preview
    • Bump github.com/google/uuid from 1.1.4 to 1.2.0 (#280) @dependabot-preview
    • Bump github.com/stretchr/testify from 1.6.1 to 1.7.0 (#277) @dependabot-preview
    • Bump github.com/google/uuid from 1.1.2 to 1.1.4 (#276) @dependabot-preview
    • Bump gopkg.in/yaml.v2 from 2.3.0 to 2.4.0 (#269) @dependabot-preview
    Source code(tar.gz)
    Source code(zip)
  • v0.9.0(Sep 22, 2020)

    What's Changed

    • Poll interval (#200) @mniak
    • refector wait.HTTPStrategy (#221) @islishude

    🐛 Bug Fixes

    • Issue #243: Introducing the default network in case "bridge" is disabled (#244) @ikolomiyets
    • PR #247: bump docker/docker to v19.03.13 @gianarb
    Source code(tar.gz)
    Source code(zip)
  • v0.8.0(Sep 9, 2020)

    What's Changed

    • Use NetworkInspect to get the gateway's IP and fallback to getDefaultGatewayIP when fails (#237) @namco1992
    • Added support for copy file to container (#226) @franklinlindemberg
    • chore: run travis in multiple versions of Go (#233) @mdelapenya
    • Allow hostname to be configured (#227) @fbiville

    🐛 Bug Fixes

    • Close db connection when sql.wait is done (#220) @islishude

    📖 Documentation

    • Fix docs index (#218) @soroushj

    🧹 Housekeeping

    • chore: simplify complex docker-compose file (#217) @mdelapenya

    📦 Dependency updates

    • Bump github.com/google/uuid from 1.1.1 to 1.1.2 (#236) @dependabot-preview
    • update docker/docker package version (#229) @snowhork
    • Bump github.com/go-redis/redis from 6.15.8+incompatible to 6.15.9+incompatible (#230) @dependabot-preview
    • github.com/docker/distribution should be an indirect dependency (#222) @islishude
    Source code(tar.gz)
    Source code(zip)
  • v0.7.0(Jun 16, 2020)

    What's Changed

    • Fix typo and URL in docs (#205) @mdelapenya
    • Small tweaks to docs (#204) @rnorth
    • chore: do not raise panic in compose, use exec error instead so the client code can handle it (#189) @mdelapenya

    🚀 Features

    • Add pass-through for entrypoint to ContainerRequest (#209) @aklinkert
    • feat: implement skip utility function for testing (#181) @gianarb

    BC Break

    • Use default timeout in SQL waiter (#196) @mniak

    🐛 Bug Fixes

    • fixes #192 - guard access to reaper with a mutex (#198) @dvulpe

    📖 Documentation

    • Grammar and spelling fixes (#211) @flimzy
    • move contents from readme to docs (#201) @gianarb
    • Bootstrap documentation with mkdocs (#191) @gianarb
    • docs: add example for wait http (#184) @gianarb

    🧹 Housekeeping

    • wait strategy where not properly set (#215) @gianarb
    • use nginx when possible when writing test (#213) @gianarb
    • Grammar and spelling fixes (#211) @flimzy
    • feat: implement skip utility function for testing (#181) @gianarb

    📦 Dependency updates

    • Bump github.com/stretchr/testify from 1.6.0 to 1.6.1 (#206) @dependabot-preview
    • Bump github.com/stretchr/testify from 1.5.1 to 1.6.0 (#202) @dependabot-preview
    • Bump github.com/go-redis/redis from 6.15.7+incompatible to 6.15.8+incompatible (#199) @dependabot-preview
    • Bump pyyaml from 3.13 to 5.1 (#195) @dependabot
    • Bump gopkg.in/yaml.v2 from 2.2.8 to 2.3.0 (#194) @dependabot-preview
    • Bump github.com/gin-gonic/gin from 1.6.2 to 1.6.3 (#190) @dependabot-preview
    • Bump github.com/stretchr/testify from 1.4.0 to 1.5.1 (#187) @dependabot-preview
    Source code(tar.gz)
    Source code(zip)
  • v0.5.1(Apr 20, 2020)

  • v0.5.0(Apr 14, 2020)

    What's Changed

    • Added ContainerIP to retrieve ip of container from primary network (#179) @gianarb

    🚀 Features

    • #173: Reaper reuse (#176) @ikolomiyets

    🐛 Bug Fixes

    • Fix/159 wait port windows (#180) @gianarb
    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Apr 10, 2020)

    What's Changed

    🚀 Features

    • Force testcontainers to always pull images when creating container (#175) @ikolomiyets

    📦 Dependency updates

    • chore(vendor): update docker engine and uuid (#177) @gianarb
    • Bump github.com/gin-gonic/gin from 1.6.1 to 1.6.2 (#170) @dependabot-preview
    • Bump github.com/gin-gonic/gin from 1.6.0 to 1.6.1 (#168) @dependabot-preview
    • Bump github.com/gin-gonic/gin from 1.5.0 to 1.6.0 (#167) @dependabot-preview
    Source code(tar.gz)
    Source code(zip)
  • v0.3.1(Mar 3, 2020)

    🐛 Bug Fixes

    • Fix infinite loop caused by "image not found" (#162) @erdemtoraman
    • Bump travis-ci Go to 1.14.x (#161) @gianarb
    • Fix reaper connect failure by waiting for listening port (#154) @itaischwartz
    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Feb 19, 2020)

    What's Changed

    • #150 If networkMode host ForListeningPort does not work (#151) @Bablzz
    • Feature #133 - Add a FollowOutput method to attach log consumers to (#135) @ClaytonNorthey92
    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Feb 10, 2020)

    What's Changed

    • (#128) Throw an error when bash is not installed in the target container (#129) @mdelapenya
    • #136 log start-up progress (#137) @nikolayk812
    • #145 Update default reaper images to 0.2.3 (#148) @Bablzz
    • fix retry logic (#147) @dmarkhas
    Source code(tar.gz)
    Source code(zip)
  • v0.1.1(Feb 5, 2020)

  • v0.1.0(Feb 3, 2020)

    What's Changed

    • Add ability to configure tmpfs for a container (#131) @rieske
    • #138 Add NetworkMode host (#140) @Bablzz
    • feat: allow viewing of logs from stopped container (#120) @ClaytonNorthey92
    • (#124) Fix Go fmt (#125) @mdelapenya

    📦 Dependency updates

    • Bump github.com/go-redis/redis from 6.15.6+incompatible to 6.15.7+incompatible (#141) @dependabot-preview
    • Bump github.com/pkg/errors from 0.9.0 to 0.9.1 (#134) @dependabot-preview
    • Bump github.com/pkg/errors from 0.8.1 to 0.9.0 (#132) @dependabot-preview
    • Bump github.com/go-sql-driver/mysql from 1.4.1 to 1.5.0 (#130) @dependabot-preview
    Source code(tar.gz)
    Source code(zip)
  • v0.0.9(Nov 20, 2019)

    What's Changed

    • fix: Add Go formatting to README code block (#104) @ClaytonNorthey92
    • #110 feature: Context as io.Reader (#113) @ClaytonNorthey92
    • #46 host port waiting strategy inside container (#114) @nikolayk812
    • Retry on any http failure (#109) @gavinbunney
    • Added few examples around Container Create and Network (#99) @gianarb
    • Added occurrence for the WaitLogStrategy (#100) @gianarb

    🐛 Bug Fixes

    • (#93) Reset internal state after container.Terminate() (#94) @mdelapenya

    📦 Dependency updates

    • Bump github.com/go-redis/redis from 6.15.5+incompatible to 6.15.6+incompatible (#103) @dependabot-preview
    • Bump github.com/go-redis/redis from 6.15.2+incompatible to 6.15.5+incompatible (#95) @dependabot-preview
    Source code(tar.gz)
    Source code(zip)
  • v0.0.10(Dec 20, 2019)

    What's Changed

    • Support volume mounts (#116) @uportalis
    • Update README.md (#123) @elyzion
    • allow alternative reaper docker registry (#119) @makasprzak
    • Add more info about failing test on Travis (#115) @mdelapenya
    Source code(tar.gz)
    Source code(zip)
  • v0.0.8(Sep 7, 2019)

    What's Changed

    🚀 Features

    • Added the ability to build from a Dockerfile (#84) @ClaytonNorthey92

    🐛 Bug Fixes

    • Add v to release name or go modules will complain (#91) @gianarb

    📦 Dependency updates

    • Bump github.com/pkg/errors from 0.8.0 to 0.8.1 (#92) @dependabot-preview
    Source code(tar.gz)
    Source code(zip)
  • v0.0.7(Sep 4, 2019)

    What's Changed

    • (#73) Support attaching containers to different networks than bridge (#76) @mdelapenya

    BC Break

    • Using a slice of strings ([]string) for Docker Cmd. (#87) @ClaytonNorthey92
    Source code(tar.gz)
    Source code(zip)
  • v0.0.6(Sep 2, 2019)

    https://github.com/testcontainers/testcontainers-go/pull/81 - Removed the legacy part of the library

    https://github.com/testcontainers/testcontainers-go/pull/83 - Added support to run multiple wait strategies for a specific container

    Source code(tar.gz)
    Source code(zip)
  • v0.0.4(May 7, 2019)

Kubedock is a minimal implementation of the docker api that will orchestrate containers on a Kubernetes cluster, rather than running containers locally.

Kubedock Kubedock is an minimal implementation of the docker api that will orchestrate containers on a kubernetes cluster, rather than running contain

Vincent van Dam 20 Oct 15, 2021
Hassle-free minimal CI/CD for git repositories with docker or docker-compose projects.

GIT-PIPE Hassle-free minimal CI/CD for git repos for docker-based projects. Features: zero configuration for repos by default automatic encrypted back

Aleksandr Baryshnikov 51 Oct 8, 2021
A magic shim for Docker credential helpers

docker-credential-magic Overview Installation Usage How to use docker-credential-magic Local setup How to use docker-credential-magician Including a s

null 27 Sep 22, 2021
Docker App Development & Command Practice

Docker App Development & Command Practice What is Docker? A platform for building,running and shipping applications. in a consistent manner so if your

MD MOSTAIN BILLAH 33 Aug 22, 2021
concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit

BuildKit BuildKit is a toolkit for converting source code to build artifacts in an efficient, expressive and repeatable manner. Key features: Automati

Moby 4.4k Oct 24, 2021
GitHub中文排行榜,帮助你发现高分优秀中文项目、更高效地吸收国人的优秀经验成果;榜单每周更新一次,敬请关注!

榜单设立目的 ???? GitHub中文排行榜,帮助你发现高分优秀中文项目; 各位开发者伙伴可以更高效地吸收国人的优秀经验、成果; 中文项目只能满足阶段性的需求,想要有进一步提升,还请多花时间学习高分神级英文项目; 榜单设立范围 设立1个总榜(所有语言项目汇总排名)、18个分榜(单个语言项目排名);

kon9chunkit 38.9k Oct 24, 2021
A toolbox for debugging docker container and kubernetes with web UI.

A toolbox for debugging Docker container and Kubernetes with visual web UI. You can start the debugging journey on any docker container host! You can

CloudNativer 7 Oct 9, 2021
Prometheus exporter for Amazon Elastic Container Service (ECS)

ecs_exporter ?? ?? ?? This repo is still work in progress and is subject to change. This repo contains a Prometheus exporter for Amazon Elastic Contai

Prometheus Monitoring Community 18 Oct 9, 2021
A curated list of awesome Kubernetes tools and resources.

Awesome Kubernetes Resources A curated list of awesome Kubernetes tools and resources. Inspired by awesome list and donnemartin/awesome-aws. The Fiery

Tom Huang 913 Oct 23, 2021
Fast docker image distribution plugin for containerd, based on CRFS/stargz

[ ⬇️ Download] [ ?? Browse images] [ ☸ Quick Start (Kubernetes)] [ ?? Quick Start (nerdctl)] Stargz Snapshotter Read also introductory blog: Startup C

containerd 426 Oct 25, 2021
runtime - an abstraction library on top of the Open Policy Agent (OPA)

runtime - an abstraction library on top of the Open Policy Agent (OPA) Introduction The "runtime" project is a library that sits on top of OPA. The go

 Aserto Inc 14 Oct 22, 2021
Learning about containers and how they work by creating them the hard way

Containers the hard way: Gocker: A mini Docker written in Go It is a set of Linux's operating system primitives that provide the illusion of a contain

Shuveb Hussain 1.3k Oct 22, 2021
k6 is a modern load testing tool for developers and testers in the DevOps era.

k6 is a modern load testing tool, building on our years of experience in the load and performance testing industry. It provides a clean, approachable scripting API, local and cloud execution, and flexible configuration.

k6 14.2k Oct 21, 2021
👀 A Kubernetes cluster resource sanitizer

Popeye - A Kubernetes Cluster Sanitizer Popeye is a utility that scans live Kubernetes cluster and reports potential issues with deployed resources an

Fernand Galiana 3.1k Oct 16, 2021
The lazier way to manage everything docker

A simple terminal UI for both docker and docker-compose, written in Go with the gocui library. This Just In: Github Sponsors is matching every donatio

Jesse Duffield 18.4k Oct 16, 2021
The k8s-generic-webhook is a library to simplify the implementation of webhooks for arbitrary customer resources (CR) in the operator-sdk or controller-runtime.

k8s-generic-webhook The k8s-generic-webhook is a library to simplify the implementation of webhooks for arbitrary customer resources (CR) in the opera

Norwin Schnyder 3 Oct 14, 2021
🐶 Kubernetes CLI To Manage Your Clusters In Style!

K9s - Kubernetes CLI To Manage Your Clusters In Style! K9s provides a terminal UI to interact with your Kubernetes clusters. The aim of this project i

Fernand Galiana 13.8k Oct 20, 2021
Docker Swarm Ingress service based on OpenResty with automatic Let's Encrypt SSL provisioning

Ingress Service for Docker Swarm Swarm Ingress OpenResty is a ingress service for Docker in Swarm mode that makes deploying microservices easy. It con

OpCycle 2 Oct 17, 2021
µTask is an automation engine that models and executes business processes declared in yaml. ✏️📋

µTask, the Lightweight Automation Engine µTask is an automation engine built for the cloud. It is: simple to operate: only a postgres DB is required s

OVHcloud 540 Oct 21, 2021