• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Unique identifier in container
#1
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!
  Reply
#2
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
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Ready-to-deploy: full featured Node-RED container Armin@netPI 3 48 Yesterday, 02:45 PM
Last Post: AlexRegev
  New Container example "OPC UA server" Armin@netPI 0 13 April-12th-2019, 11:51 AM
Last Post: Armin@netPI
  Official Node-RED container Armin@netPI 0 15 April-5th-2019, 10:39 AM
Last Post: Armin@netPI
  Multi-stage builds for slim container images Armin@netPI 0 10 February-7th-2019, 04:14 PM
Last Post: Armin@netPI
Information [INFO] Setting the correct timezone in a container Armin@netPI 0 10 February-3rd-2019, 08:23 AM
Last Post: Armin@netPI
  [SOLVED] activate LED1/2 with Node-RED + fieldbus nodes container Christian_Rau 5 75 January-11th-2019, 08:06 AM
Last Post: Armin@netPI
  [SOLVED] install ssh service to running container paubau 2 135 October-12th-2018, 01:03 PM
Last Post: paubau
  [SOLVED] nodered : flows_localhost deleted after creating an image from container paubau 6 186 September-21st-2018, 10:19 AM
Last Post: paubau
  [SOLVED] MySQL Container / Server in another Container? paubau 2 152 September-5th-2018, 08:00 AM
Last Post: paubau
  [SOLVED] STDOUT logging when container is started with -I and some CMD Thomas 2 165 August-23rd-2018, 01:19 PM
Last Post: Armin@netPI

Forum Jump:


Users browsing this thread: 1 Guest(s)