# commit
Commit the container to a new image.
```rhai
bah.commit(image_name) -> Bah
```
## Parameters
- `image_name` (string): The name and optional tag for the new image (e.g., "myimage:latest")
## Returns
Returns the `Bah` builder for method chaining.
## Examples
```rhai
let builder = bah("mycontainer", "ubuntu:22.04")
.run("apt update")
.run("apt install -y nginx")
.set_entrypoint("/usr/sbin/nginx")
.commit("nginx:custom");
print("Image created successfully");
print(builder.stdout);
```
## Notes
- This is a chainable method
- Creates a new image from the container's current state
- The container persists after commit
- Use `remove()` to clean up the container after committing