
Product
Go Support Is Now Generally Available
Socket's Go support is now generally available, bringing automatic scanning and deep code analysis to all users with Go projects.
git.cryptic.systems/volker.raschek/dockerutils
dockerutils is a small library which extends the official docker library to create and start images over a builder. Additionally the library provide functions for easy removeing resources based on ids, names or labels which the official library does not directly supports.
Install the library by the following command:
go get git.cryptic.systems/volker.raschek/dockerutils
package main
import "git.cryptic.systems/volker.raschek/dockerutils"
func noErr(err){
if err != nil {
panic(err)
}
}
func main(){
dockerClient, err := dockerutils.New()
noErr(err)
postgresContainerID, err := dockerClient.NewBuilder("postgres:13-alpine").
Port(fmt.Sprintf("5432:5432/tcp", postgresHostPort)).
Pull().
AddEnv("PGTZ", "Europe/Berlin").
AddEnv("POSTGRES_PASSWORD", postgres).
AddEnv("TZ", "Europe/Berlin").
Mount("/etc/localtime", "/etc/localtime").
Start(context.Background())
noErr(err)
defer func(){dockerClient.ContainerRemoveByIDs(context.Background(), postgresContainerID)}
}
package main
import (
"git.cryptic.systems/volker.raschek/dockerutils"
"github.com/docker/docker/api/types"
)
func noErr(err){
if err != nil {
panic(err)
}
}
func main(){
dockerClient, err := dockerutils.New()
noErr(err)
containerNetwork, err := dockerClient.NetworkCreate(ctx, "my-network", tt.NetworkCreate{Labels: map[string]string{"key": "value"}})
noErr(err)
defer func(){dockerClient.NetworkRemove(context.Background(), containerNetwork.ID)}
}
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Go support is now generally available, bringing automatic scanning and deep code analysis to all users with Go projects.
Security News
vlt adds real-time security selectors powered by Socket, enabling developers to query and analyze package risks directly in their dependency graph.
Security News
CISA extended MITRE’s CVE contract by 11 months, avoiding a shutdown but leaving long-term governance and coordination issues unresolved.