Note: This article is intended for engineers who are working directly with Docker images, and involves use of a terminal. You only need to do this if you’re responsible for the Docker images that are being prepared for use in Virtual Labs!
Prior to taking these steps, we’ll create a service account for your team, which will allow you to push and pull images from the registry, as well as a private Docker registry on Google Cloud. This is likely in our shared Keybase directory.
Log into the Docker registry
First you need to log into the private Docker registry using the JSON key we’ll provide you with via
Keybase.io (if you don’t have an account, please make one and follow your CSM! If you can’t find them, let us know and we’ll give you a link). Navigate to where you saved the keyfile and run this command:
Keybase.io (if you don’t have an account, please make one and follow your CSM! If you can’t find them, let us know and we’ll give you a link). Navigate to where you saved the keyfile and run this command:
$ cat [your-keyfile].json | docker login -u _json_key --password-stdin https://gcr.io
Push and pull an image
Once you’ve logged in, per the section above, you should be able to push and pull images at will.
The registry works by watching for the proper tag. Anything prepended with `gcr.io/your-site-name/` (such as ‘gcr.io/acme-corp-labs’) will tell Docker to push and pull from this private registry. If you’re not certain on the tag to use, just ask us for it.
For example:
$ docker pull gcr.io/your-site-name/stable/ttyd-orion
To push an image, simply push instead of pull (as you might expect):
$ docker push gcr.io/your-site-name/stable/ttyd-orion
Move an image from local dev to the remote registry
If you have, for example, made changes to an image locally, and want to push the latest version to the remote registry, simply add the prefix and push:
Build your image
$ docker build -t your-image-name
Tag it with the Google Cloud registry prefix:
$ docker tag your-image-name gcr.io/your-site-name/your-image-name
Push it to the registry:
$ docker push gcr.io/your-site-name/your-image-name
Maintaining multiple versions
You can use tagged versions in our dashboard, just like you would locally.
$ docker tag your-image-name:latest your-image-name:v2
$ docker tag your-image-name:v2 gcr.io/your-site-name/your-image-name:v2
$ docker push gcr.io/your-site-name/your-image-name:v2
Your team can then pull this to the dashboard by appending
:v2 to the name of the image in the Virtual Labs dashboard.
:v2 to the name of the image in the Virtual Labs dashboard.
Pulling the image to the Virtual Labs dashboard
Once you’ve pushed an image, you’ll need to pull it into the dashboard.
See the instructions here to do so: