Hyper Docs
  • Introduction
  • What is Hyper
  • Why Hyper
  • Regions
  • Pricing
  • Quota and Limits
  • FAQ
  • Getting Started
    • Generate API Credential
    • Install CLI
    • Part 1 - Starting and inspecting your first container
    • Part 2 - Working with multiple containers
    • Part 3 - Hyper Compose
    • Migrate data
      • hyper container as client
      • hyper container as server
  • Features
    • Container
      • Container
      • Logs
      • Compose
      • Cron
      • Service
      • Func
    • Storage
      • Volume
      • Snapshot
    • Network
      • Network
      • Floating IP
      • Port
      • Security Group
    • Console
      • Filter
  • Reference
    • CLI
      • attach
      • commit
      • config
      • create
      • exec
      • images
      • info
      • inspect
      • kill
      • load
      • login
      • logout
      • logs
      • port
      • ps
      • pull
      • push
      • rename
      • restart
      • rm
      • rmi
      • run
      • search
      • start
      • stats
      • stop
      • version
      • update
      • wait
      • Volume
        • create
        • init
        • inspect
        • ls
        • rm
      • Snapshot
        • create
        • ls
        • rm
      • FIP
        • allocate
        • attach
        • detach
        • ls
        • release
        • name
      • Security Group
        • create
        • ls
        • inspect
        • rm
        • update
      • Compose
        • create
        • down
        • up
        • rm
        • ps
        • pull
        • run
        • kill
        • start
        • stop
        • scale
      • Service
        • create
        • ls
        • inspect
        • scale
        • rolling-update
        • attach-fip
        • detach-fip
        • rm
      • Cron
        • create
        • inspect
        • ls
        • history
        • rm
      • Func
        • create
        • update
        • inspect
        • ls
        • rm
        • logs
        • call
        • get
    • API
      • 2016-04-04 [Ver. 1.23]
        • Container
          • List Containers
          • Create a container
          • Get container logs
          • Start a container
          • Stop a container
          • Restart a container
          • Resize a container
          • Rename a container
          • Kill a container
          • Attach to a container
          • Remove a container
          • Update a container
          • Get container stats
          • Inspect a container
          • Exec Create
          • Commit a container
        • Event
          • Monitor events with WebSocket
        • Misc
          • Display system-wide information
          • Show the hyper version information
          • Exec Start
          • Exec Resize
          • Exec Inspect
        • Image
          • Inspect Images
          • Search Images
          • List Images
          • Load Images
          • Create an image
          • Remove an image
          • Push an image
        • Volume
          • List volumes
          • Create a volume
          • Remove a volume
          • Init a volume
          • Inspect a volume
        • Snapshot
          • Create a snapshot
          • List snapshots
          • Inspect a snapshot
          • Remove a snapshot
        • Network
          • Allocate floating IP
          • Attach a floating IP to a (running) container
          • Detach floating IP from a (running) container
          • List floating IP
          • Release floating IP
          • Name floating IP
        • Security Group
          • Create a security group
          • Remove a security group
          • Inspect a security group
          • Update a security group
          • List security groups
        • Service
          • service create
          • service list
          • service inspect
          • service update
          • service remove
        • Compose
          • Compose up
          • Compose create
          • Compose down
          • Compose rm
          • Compose start
          • Compose stop
          • Compose kill
        • Cron
          • Cron create
          • Cron list
          • Cron inspect
          • Cron remove
          • Cron history
        • Func
          • Func create
          • Func update
          • Func list
          • Func inspect
          • Func remove
          • Func call
          • Func get
          • Func logs
          • Func status
    • Compose File Reference
    • Security Group Reference
  • FAQ
    • Pricing
    • Quota and Limits
    • Privacy Policy
    • Terms of Service
    • Acceptable Use Policy
  • Docs version
Powered by GitBook
On this page
  • Examples
  • Commit a container
  • Commit a container with a new configuration
  • Commit a container with new CMD instruction
  1. Reference
  2. CLI

commit

Usage: hyper commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]

Create a new image from a container's changes

  -a, --author=""     Author (e.g., "John Hannibal Smith <hannibal@a-team.com>")
  -c, --change=[]     Apply specified Dockerfile instructions while committing the image
  --help              Print usage
  -m, --message=""    Commit message

It can be useful to commit a container's file changes or settings into a new image. This allows you to debug a container by running an interactive shell, or to export a working dataset to another server. However, it is generally better to use Dockerfiles to manage your images in a documented and maintainable way.

The commit operation will not include any data contained in volumes mounted inside the container.

The --change option will apply Dockerfile instructions to the image that is created. Supported Dockerfile instructions: CMD|ENTRYPOINT|ENV|EXPOSE|LABEL|ONBUILD|USER|VOLUME|WORKDIR

The commit operation only works on stopped container for now.

Examples

Commit a container

$ hyper ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS                          PORTS
50d6ab76a13a        busybox             "sh"                About a minute ago   Exited (0) 3 seconds ago

$ hyper commit 50d6ab76a13a user/testimage:v1
sha256:a0696d8da7b60abe14cb962156fee7c03cbcafd02e8b5ed8de679a5a1a5f768f

$ hyper images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
user/testimage      v1                  a0696d8da7b6        30 seconds ago      1.126 MB

Commit a container with a new configuration

$ hyper ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS                           PORTS
50d6ab76a13a        busybox             "sh"                About a minute ago   Exited (0) 10 seconds ago

$ hyper inspect -f "{{ .Config.Env }}" 50d6ab76a13a
[PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin]

$ hyper commit --change "ENV DEBUG true" 50d6ab76a13a  user/testimage:v2
sha256:8a0cb365e21b94328e0fe8727ff347051e8bc0292fa8c5d1450a9b1d272bbaa4

$ hyper inspect -f "{{ .Config.Env }}" 8a0cb365e21b
[DEBUG=true PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin]

Commit a container with new CMD instruction

$ hyper ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS                          PORTS
50d6ab76a13a        busybox             "sh"                About a minute ago   Exited (0) About a minute ago

$ hyper commit --change='CMD ["top"]' 50d6ab76a13a  user/testimage:v3
sha256:ba79cd631395b20e415683f8a845bf89ef7b1d2237e609cead97e2a119f9e689

$ hyper run -d user/testimage:v3
9ad6e8b3e34e5e35c30f5c82548f5a47702803f8336cdb7db4e6cff6f637ee55

$ hyper ps -a
ID                  IMAGE                  COMMAND          CREATED             STATUS                           PORTS
9ad6e8b3e34e        user/testimage:v3      "top"            39 seconds ago      Up 35 seconds
50d6ab76a13a        busybox                "sh"             About a minute ago  Exited (0) About 3 minutes ago
PreviousattachNextconfig

Last updated 7 years ago