How to automatically update your docker containers, if base-images are updated -
Say that I have a poor container based on Ubuntu: latest
. Now a security update and Ubuntu: latest
has been updated to Docker Repo.
1) How can I know my local image and its containers are running behind?
2) Is there some excellent practice to automatically update local images and containers in order to follow the Docker repo update, which will harm you like unread upgrades running on traditional Ubuntu machine?
We use a script that checks whether the running container starts with the latest image has gone. We also use the upstart init script to start the Docker image.
#! / Usr / bin / env bash set -e BASE_IMAGE = "registry" registry = "registry.hub.docker.com" IMAGE = "$ REGISTRY / $ BASE_IMAGE" cid = $ (docked PS | GRAP $ IMAGE | awk ' {Print $ 1} ') Drag the IAG for $ C $ D $ D $ in Dock = `Docker Inspection - Format' {{. Id}} "$ IMAGE` running =` docked by inspection - format '{{image}} "$ im` name =` dockkey inspection - format' {{.}} '$ Im | Sed "s / \ /// g" `echo 'latest:" $ Recently buzz "is running:" $ [running] $ $ running! "=" $ Fresh "]; Then" Donager- NAME docker rm Start by doc -f $ NAME - $ NAME resonates with other "$ NAME up to date"
and init looks like
Docker Run - T -i --name $ NAME $ im / bin / bash
Comments
Post a Comment