copy-docker-image icon indicating copy to clipboard operation
copy-docker-image copied to clipboard

Program terminates abnormally when copying between two repositories

Open JoelRabinovitch opened this issue 7 years ago • 5 comments

When I try to copy Docker containers from one Amazon repository to another using the copy-docker-image utility on Windows, I receive the following errors:

  • The system is unable to remove a temporary file.
  • The system is unable to handle the destination manifest.

This is the command I am using:

copy-docker-image_windows_amd64.exe --src-url ecr:123456789012 --src-repo src_repo --dest-url ecr:123456789012 --dest-repo dest_repo --tag="latest"

This is the output I am getting (Note: I have changed the values for privacy): ... Need to upload layer sha256:3e17c6eae66cd23c59751c8d8f5eaf7044e0611dc5cebb12b1273be07cdac242 to the destination 2018/10/17 17:04:39 registry.layer.download url=https://123456789012.ecrrepo.amazonaws.com/v2/src_repo/blobs/sha256:3e17c6eae66cd23c59751c8d8f5eaf7044e0611dc5cebb12b1273be07cdac242 repository=src_repo digest=sha256:3e17c6eae66cd23c59751c8d8f5eaf7044e0611dc5cebb12b1273be07cdac242 2018/10/17 17:04:44 registry.layer.initiate-upload url=https://123456789012.ecrrepo.amazonaws.com/v2/dest_repo/blobs/uploads/ repository=dest_repo 2018/10/17 17:04:44 registry.layer.upload url=https://123456789012.ecrrepo.amazonaws.com/v2/dest_repo/blobs/uploads/20b341ec-299c-5a4e-24fc-e6b65943be07?digest=sha256%3A3e17c6eae66cd23c59751c8d8f5eaf7044e0611dc5cebb12b1273be07cdac242 repository=dest_repo digest=sha256:3e17c6eae66cd23c59751c8d8f5eaf7044e0611dc5cebb12b1273be07cdac242 Failed to remove image layer temp file C:\Users\joelr\AppData\Local\Temp\docker-image424633583. remove C:\Users\joelr\AppData\Local\Temp\docker-image424633583: The process cannot access the file because it is being used by another process.2018/10/17 17:04:57 registry.manifest.put url=https://123456789012.ecrrepo.amazonaws.com/v2/dest_repo/manifests/latest repository=dest_repo reference=latest Failed to upload manifest to https://123456789012.ecrrepo.amazonaws.com/dest_repo:latest. Put https://123456789012.ecrrepo.amazonaws.com/v2/dest_repo/manifests/latest: http: non-successful response (status=405 body="{"errors":[{"code":"UNSUPPORTED","message":"Invalid parameter at 'ImageManifest' failed to satisfy constraint: 'Repository name in ImageManifest should match that in the request'"}]}\n")

Let me know how I can get around this problem.

JoelRabinovitch avatar Oct 19 '18 15:10 JoelRabinovitch

I don't have any experience with Windows or with the problem you point out. I don't have a windows machine lying around to test with either.

If you want to debug, it looks like a problem might be related to The process cannot access the file because it is being used by another process. That seems bad. Any reason why that might happen?

mdlavin avatar Oct 22 '18 12:10 mdlavin

On windows, only a single file handle can be open for the same file, if you don't pass special flags when opening the file handle. It might be the same process, or e. G. a virus scanner, or other third party software. In case of a virus scanner, retrying later might help (e. g. the APR library has retry loops with exponential backoff on the windows platform).

markusschaber avatar Jun 05 '19 08:06 markusschaber

Failed to remove image layer temp file C:\Users\joelr\AppData\Local\Temp\docker-image424633583. remove C:\Users\joelr\AppData\Local\Temp\docker-image424633583: The process cannot access the file because it is being used by another process.

It looks like file is open by something while copy-docker-image tries to remove it. It might be open by the copy-docker-image itself, or by something else, like antivirus. However, modern antiviruses don't block files usually.

alderben-mts-ru avatar Dec 02 '20 11:12 alderben-mts-ru

I haven't seen that before. Does it happen reliably? I don't know enough about Windows to help provide debugging guidance. Is there a way to discover what is holding the file open?

mdlavin avatar Dec 06 '20 13:12 mdlavin

Does it happen reliably?

for me it does, thus I abandoned copy-docker-image and switched to crane.

I don't know enough about Windows to help provide debugging guidance. Is there a way to discover what is holding the file open?

there's even port of lsof, but there are also tons of gui tools. For example https://live.sysinternals.com/procexp.exe and https://live.sysinternals.com/procmon.exe are must-have (check sysinternals.com for who are they from).

alderben-mts-ru avatar Dec 07 '20 09:12 alderben-mts-ru