from conda_docker.docker.base import Image
from conda_docker.registry.client import pull_image
image = pull_image('continuumio/miniconda3', 'latest')
image.remove_layer()
image.name = 'this-is-a-test'
image.add_layer_path('./')
image.add_layer_contents({
'this/is/a/test1': b'this is test 1',
'this/is/a/test2': b'this is test 2'
})
image.layers[0].config['Env'].append('FOO=BAR')
image.write_file('example-filter.tar')
This added the environment variable FOO. In general you should be able to update all docker settings now: LABEL, ENV, ENTRYPOINT, CMD, etc. Note that the first layer is the only layer looked at for docker settings... v2 changes this behavior by not storing the config in layers. But since this implements only the v1 spec I chose the v1 spec way of updating.
Need a good way to test this.
I ran
This added the environment variable FOO. In general you should be able to update all docker settings now: LABEL, ENV, ENTRYPOINT, CMD, etc. Note that the first layer is the only layer looked at for docker settings... v2 changes this behavior by not storing the config in layers. But since this implements only the v1 spec I chose the v1 spec way of updating.