commit.rst 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. :title: Commit Command
  2. :description: Create a new image from a container's changes
  3. :keywords: commit, docker, container, documentation
  4. ===========================================================
  5. ``commit`` -- Create a new image from a container's changes
  6. ===========================================================
  7. ::
  8. Usage: docker commit [OPTIONS] CONTAINER [REPOSITORY [TAG]]
  9. Create a new image from a container's changes
  10. -m="": Commit message
  11. -author="": Author (eg. "John Hannibal Smith <hannibal@a-team.com>"
  12. -run="": Configuration to be applied when the image is launched with `docker run`.
  13. (ex: '{"Cmd": ["cat", "/world"], "PortSpecs": ["22"]}')
  14. Full -run example (multiline is ok within a single quote ``'``)
  15. ::
  16. $ sudo docker commit -run='
  17. {
  18. "Entrypoint" : null,
  19. "Privileged" : false,
  20. "User" : "",
  21. "VolumesFrom" : "",
  22. "Cmd" : ["cat", "-e", "/etc/resolv.conf"],
  23. "Dns" : ["8.8.8.8", "8.8.4.4"],
  24. "MemorySwap" : 0,
  25. "AttachStdin" : false,
  26. "AttachStderr" : false,
  27. "CpuShares" : 0,
  28. "OpenStdin" : false,
  29. "Volumes" : null,
  30. "Hostname" : "122612f45831",
  31. "PortSpecs" : ["22", "80", "443"],
  32. "Image" : "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
  33. "Tty" : false,
  34. "Env" : [
  35. "HOME=/",
  36. "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
  37. ],
  38. "StdinOnce" : false,
  39. "Domainname" : "",
  40. "WorkingDir" : "/",
  41. "NetworkDisabled" : false,
  42. "Memory" : 0,
  43. "AttachStdout" : false
  44. }' $CONTAINER_ID