Hilscher Forum
[SOLVED] Unique identifier in container - Printable Version

+- Hilscher Forum (https://forum.hilscher.com)
+-- Forum: netPI - Ruggedized Raspberry Pi with Industrial Ethernet (https://forum.hilscher.com/Forum-netPI-Ruggedized-Raspberry-Pi-with-Industrial-Ethernet)
+--- Forum: Software (https://forum.hilscher.com/Forum-Software)
+--- Thread: [SOLVED] Unique identifier in container (/Thread-SOLVED-Unique-identifier-in-container)



[SOLVED] Unique identifier in container - mmolder - January-23rd-2019

Hi!

I was wondering what the best way to obtain an unique identifier from within a docker container running on the netPI core 3. I'm using the netpi raspbian image and use the command 
Code:
cat /proc/cpuinfo | grep Serial | cut -d ' ' -f 2

to read the serial, similar as I would on a regular Raspberry Ri. Is this id unique to the hardware or does it belong to the container? Is there any other unique identifier for the netPI core 3 available which is better than the one i obtain? Also, i notices that the id which you get by doing this contains the 6 last characters of the MAC-addr of the device and two additional characters which seem random. Are these random or is there a logical way to figure them out without using the command above?
Thank you!


RE: Unique identifier in container - Armin@netPI - January-23rd-2019

Hello,

this ID you are referencing is the serial number of the BCM CPU chip.

The chip's serial number and other informations like the MAC address are stored into the CPU's One-Time Programmable (OTP) memory block at the time the chips were produced.

So it is not the ID of the container it is a unique ID of your specific netPI CORE 3 hardware.

Getting the outside ID of the container in an application that runs within the containers works with this command for example:


Code:
head -1 /proc/self/cgroup|cut -d/ -f3