-
Notifications
You must be signed in to change notification settings - Fork 25
Create update image from running container
Harish Kumar edited this page Dec 13, 2016
·
3 revisions
Sometimes developers have to create or update an image from running container and push them to registry to make their changes available to others.
This is a step by step guide to create an image from locally runnning container and push it to the registry 10.84.34.155:5000.
- Follow https://github.com/Juniper/contrail-docker/wiki/Configure-docker-service-to-use-insecure-registry to configure docker with insecure registry
- Take a snapshot of running container
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
207a65178c09 10.84.34.155:5000/contrail-kube-manager:4.0.0.0-3016 "/entrypoint.sh" 14 seconds ago Up 12 seconds contrail-kube-manager
# Need to take snapshot of contrail-kube-manager
$ docker commit contrail-kube-manager
sha256:f65aa930ccc560af7b1d44071b20e8d3ac820d4f896a5c63f9bd8428114350c0
# Note above id (f65aa930ccc560af7b1d44071b20e8d3ac820d4f896a5c63f9bd8428114350c0) - this need to be used in further steps
- Create a small dockerfile with below contents
$ mkdir /tmp/kube_manager # you can create the directory with any name btw
$ vi /tmp/kube_manager/Dockerfile
# Add below content to /tmp/kube_manager/Dockerfile
# Change below id to valid image id you get from above step (docker commit)
FROM f65aa930ccc560af7b1d44071b20e8d3ac820d4f896a5c63f9bd8428114350c0
ENTRYPOINT /entrypoint.sh
- Build docker image
$ docker build -t 10.84.34.155:5000/contrail-kube-manager:4.0.0.0-3016 /tmp/kube_manager/
- Push new image to registry
$ docker push 10.84.34.155:5000/contrail-kube-manager:4.0.0.0-3016
Copyright (c) 2018 Juniper Networks, Inc. All rights reserved