package main import ( "github.com/docker/docker/daemon/graphdriver" ) func main() { // Get a list of available graph drivers drivers := graphdriver.GetDrivers() // Iterate over the drivers and print their names for _, driver := range drivers { fmt.Println(driver.Name()) } }
package main import ( "github.com/docker/docker/daemon/graphdriver/aufs" ) func main() { // Create a new instance of the AUFS graph driver driver, err := aufs.NewDriver("/var/lib/docker/aufs") if err != nil { fmt.Println("Error creating AUFS driver:", err) return } // Use the driver to create a new layer layerID, err := driver.Create(id, parent, "", nil) if err != nil { fmt.Println("Error creating layer:", err) return } fmt.Println("New layer ID:", layerID) }This code example demonstrates how to create a new layer using the AUFS graph driver provided by the `github.com.docker/docker.daemon.graphdriver.aufs` package. The driver is first initialized with a path to the AUFS storage directory. Then, the `Create()` function is called to create a new layer with the specified parameters (in this case, a blank layer with no parent and no filesystem data). The ID of the newly created layer is printed to the console.