TransWikia.com

How to change "Volume Serial Number" in Windows docker image?

Super User Asked by Erik Ovegård on November 14, 2021

I am trying to change the “Volume Serial Number” of a docker image with Sysinternals VolumeId but I’m getting Error reading drive: The request is not supported. when I run Volumeid64.exe C: 1AAA-111A -nobanner -accepteula.

I’ve also tried with volumeid.exe. I’m quit new to Docker so it feels like I might be make a beginner mistake, or is this a limitation of Docker and/or Volumeid?

The complete Dockerfile looks as follows

FROM microsoft/windowsservercore

WORKDIR C:/sysinternals
RUN powershell -Command 
  Invoke-WebRequest -outfile VolumeId.zip "https://download.sysinternals.com/files/VolumeId.zip" -UseBasicParsing; ` 
  Expand-Archive VolumeId.zip -DestinationPath c:sysinternals ; ` Remove-Item VolumeId.zip ; ` 
  Invoke-Expression 'c:sysinternalsVolumeid64.exe C: 1AAA-111A -nobanner -accepteula'

CMD vol c:

One Answer

Most probably it's a limitation of the windows docker implementation. There is blank-base.vhdx in the root layer of a Windows OS image (See C:ProgramDataDockerwindowsfilter). Docker generates this file each time it pulls a root layer. I was managed to change the Volume ID inside by the next sequence:

  • attach blank.vhdx which is relying on blank-base.vhdx
  • assign a drive letter,
  • change volume id by volumeid64.exe,
  • detach.

And yes, all containers that inherently use the same windows OS root layer will have the same volume id.

Answered by Dmitriy Ivanov on November 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP