pip install -U donodo
donodo pull DOI
where DOI
is the Zenodo DOI or link to the record.
export ZENODO_TOKEN=your_Zenodo_API_token
donodo push your/image:tag
See donodo push -h
for options.
Use donodo --sandbox
to act on the sandbox https://sandbox.zenodo.org.
The donodo pull
command takes as additional argument either a DOI, a DOI link, or a Zenodo record link.
The command looks by priority for (1) a file whose name starts with image.tar
(2) a file whose name contains .tar
.
The filename can ends with either .tar
or .tar.gz
.
Whenever a single file is found, it will be downloaded and sent to the docker load
command; otherwise an error is thrown.
Note that the name and tag of the Docker image are specified within the image file. It will be displayed at the end of the process.
The donodo push
commands takes as additional argument the name of the Docker image, including tag (which cannot be latest
). The Docker image has to exist locally.
The command will create a new record with the title being by default Docker image {image_name}
. If such a record already exists, it will create a new version of it with the tag of the Docker image.
Thus if you push several tags of the same image name, only a single record will be created, with different versions.
The Docker image is exported using the docker save
command and compressed in a local temporary file. The file is then uploaded to the Zenodo record as image.tar.gz
.
Once the draft record has been created, the command will display the link to the draft and ask whether to publish it.
You can modify the record from the webpage if necessary before answering the question.
The option --auto-publish
skips this question and promptly publishes the image.
Once published, the command will display its DOI link.
The push
command requires a Zenodo API token, given in the ZENODO_TOKEN
environment variable. You can create an API token at https://zenodo.org/account/settings/applications/ with the deposit:write and deposit:actions scopes.
The templates used to fill the fields of the Zenodo deposition are specified by the deposition_templates
variable in donodo/templates.py.
The templates will be interpreted as Python f-string, and have access to the variable image
which is a DockerImage
object having the following fields:
image.name
being the name of the Docker imageimage.tag
being the tag of the Docker imageimage.labels
being a dictionnary of the labels specified in the Docker imageimage.inspect
being the dictionnary as returned by thedocker inspect
command.
The templates can be overriden using a JSON file given with the option --templates
.
Example: docker push --templates mytemplates.json my/image:v1
with mytemplates.json
being
{
"creators": [{"name":"Smith, Jane", "affiliation": "My University", "orcid": "0000-0002-1694-233X"}],
"keywords": ["docker image", "my topic"]
}
You can specify any fields of a Zenodo deposition, following the specification at https://developers.zenodo.org/#representation.