Quick how-to about Docker commands.
Getting Docker container IP
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id
Getting Docker container variable value
docker exec <container_id> bash -c 'echo "$ENV_VAR"'
Saving Docker image on hard disk drive
docker save myimage:version | gzip > myimage_version.tar.gz
Loading Docker images from archive
docker load -i myimage_version.tar.gz
Pushing image from local Docker registry to another registry
Very useful when deploying IBM FileNet on OpenShift, by the way 😉 Maybe on another post 🙂
docker tag myimage:version <remote-registry-dns-or-ip>:<remote-registry-port>/<namespace>/myimage:version docker push <remote-registry-dns-or-ip>:<remote-registry-port>/<namespace>/myimage:version
And if you want to do it on OKD (“oc whoami -t” command will output the user password as a user token, “remote-registry-dns-or-ip” / “remote-registry-port” are usually “172.30.1.1” / “5000”
oc login -u <oc-username> -p <oc-password> oc project <namespace> docker login -u <oc-username> -p $(oc whoami -t) <remote-registry-dns-or-ip>:<remote-registry-port> docker tag myimage:version <remote-registry-dns-or-ip>:<remote-registry-port>/<namespace>/myimage:version docker push <remote-registry-dns-or-ip>:<remote-registry-port>/<namespace>/myimage:version docker logout
Please follow and like us: