I have a go routine running in docker container. I need output of the command dmidecode. But its coming blank.
Go:
func main() {
cmd := exec.Command("dmidecode","-t 1")
x,_ := cmd.Output()
fmt.Println("output =======", string(x))
}
Docker run:
docker run --device /dev/mem:/dev/mem --cap-add SYS_RAWIO -p 8086:8086 -it my_img:1.0.1
What am I missing here?
Updated:
The above worked in docker after I added below in Dockerfile:
FROM alpine:latest
RUN apk --no-cache --update --verbose add grep bash dmidecode &&
rm -rf /var/cache/apk/* /tmp/* /sbin/halt /sbin/poweroff /sbin/reboot
And below in docker compose file:
privileged: true
But When tried to use the above in kubernetes it not able to fetch demidecode output.
A help will be really appreciated.