Skip to content

Why the IP keep changing after a restart of docker container? #44

Answered by yongqianme
linkdesu asked this question in Q&A
Discussion options

You must be logged in to vote

The problem is the machineid. We use github.com/panta/machineid in the omniedge cli to get the machine id from machine.

# https://github.com/omniedgeio/omniedge-cli/blob/8aaa5bfe1ac81e8ea135d7d025bdbc878a4466e8/utils.go
func RevealHardwareUUID() (string, error) {
	id, err := machineid.ID()
	if err != nil {
		return "", errors.New(fmt.Sprintf("Fail to generate hardware id, err is %+v", err))
	}
	id = strings.ToLower(strings.Replace(id, "-", "", -1))
	idBytes, err := hex.DecodeString(id)
	if err != nil {
		return "", errors.New(fmt.Sprintf("Fail to generate hardware id, err is %+v", err))
	}
	hardwareUUID, err := uuid.FromBytes(idBytes)
	if err != nil {
		return "", errors.New(fmt.Sprintf(…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@linkdesu
Comment options

Answer selected by yongqianme
Comment options

You must be logged in to vote
2 replies
@Yong-OmniEdge
Comment options

@codering
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants