Docker Community Forums

Share and learn in the Docker community.

  • Primary Action
  • Another Action

Panic: assignment to entry in nil map

When doing docker login in the command prompt / powershell, I the error posted below. Though when doing this, docker desktop gets logged in just fine.

login Authenticating with existing credentials… panic: assignment to entry in nil map

goroutine 1 [running]: github.com/docker/cli/cli/config/credentials.(*fileStore).Store (0xc0004d32c0, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x149b9b7, …}, …})

Although powershell is available for Linux and macOS as well, I assume you installed Docker Desktop on Windows, right?

I thing so because I have the same problem and I certainly installed on Windows… Do you have a solution? QVQ

I believe I’m experiencing the same issue - new laptop, new docker desktop for windows install. can’t login via command line:

goroutine 1 [running]: github.com/docker/cli/cli/config/credentials.(*fileStore).Store (0xc0004d4600, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0xc00003c420, …}, …}) /go/src/github.com/docker/cli/cli/config/credentials/file_store.go:55 +0x49

I’m experiencing the same issue with my new windows laptop with fresh installation of docker.

Sorry, shortly after posting, I came to think about this very important info. You are of course absolutely correct. This is on a freshly installed Windows 11, latest docker-desktop.

I could try, if wanted. To do a fresh install on a Linux box and see if I experience the same issue there?

I have the same issue, works for me when I use WT and ubuntu, but not from cmd, git bash or powershell

If it is not a problem for you, that coud help to find out if it is only a Windows issue, but since so many of you had the same issue on the same day, it is very likely to be a bug. Can you share this issue on GitHub?

I tried it on my Windows even though I don’t use Docker Desktop on Windows only when I try to help someone, and it worked for me but it doesn’t mean that it’s not a bug.

If you report the bug on GitHub and share the link here, everyone can join the conversation there too.

In the meantime everyone could try to rename the .docker folder in the \Users\USERNAME folder and try the docke rlogin command again. If the error was something in that folder, that can fix it, but even if it is the case, it shouldn’t have happened.

you cloud try to run docker logout and then docker login ,it works for me .

That’s a good idea too.

I can verify that this did help on my PC too. I have created en issue here:

Hi all, a fix for this will be tracked on the docker/cli issue tracker: Nil pointer dereference on loading the config file · Issue #4414 · docker/cli · GitHub

I was using “az acr login” to do an azure registry docker login and getting this error, but I followed your advice and did a “docker logout” and that cleaned up my issue.

worked for my on my box (latest docker - Docker version 24.0.2, build cb74dfc) on W11. thx for solution.

its work for me. Recommend!

This solution works for me

“docker logout” works for me. Thank you!

Logout worked here too!

Example error:

This panic occurs when you fail to initialize a map properly.

Initial Steps Overview

  • Check the declaration of the map

Detailed Steps

1) check the declaration of the map.

If necessary, use the error information to locate the map causing the issue, then find where this map is first declared, which may be as below:

The block of code above specifies the kind of map we want ( string: int ), but doesn’t actually create a map for us to use. This will cause a panic when we try to assign values to the map. Instead you should use the make keyword as outlined in Solution A . If you are trying to create a series of nested maps (a map similar to a JSON structure, for example), see Solution B .

Solutions List

A) use ‘make’ to initialize the map.

B) Nested maps

Solutions Detail

Instead, we can use make to initialize a map of the specified type. We’re then free to set and retrieve key:value pairs in the map as usual.

B) Nested Maps

If you are trying to use a map within another map, for example when building JSON-like data, things can become more complicated, but the same principles remain in that make is required to initialize a map.

For a more convenient way to work with this kind of nested structure see Further Step 1 . It may also be worth considering using Go structs or the Go JSON package .

Further Steps

  • Use composite literals to create map in-line

1) Use composite literals to create map in-line

Using a composite literal we can skip having to use the make keyword and reduce the required number of lines of code.

Further Information

https://yourbasic.org/golang/gotcha-assignment-entry-nil-map/ https://stackoverflow.com/questions/35379378/go-assignment-to-entry-in-nil-map https://stackoverflow.com/questions/27267900/runtime-error-assignment-to-entry-in-nil-map

Assignment to entry in nil map

docker panic assignment to entry in nil map

Why does this program panic?

You have to initialize the map using the make function (or a map literal) before you can add any elements:

See Maps explained for more about maps.

Navigation Menu

Search code, repositories, users, issues, pull requests..., provide feedback.

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly.

To see all available qualifiers, see our documentation .

  • Notifications

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: assignment to entry in nil map #13968

@ianw

ianw commented Apr 22, 2022 • edited

@giuseppe

giuseppe commented Apr 22, 2022

  • 👀 1 reaction

Sorry, something went wrong.

@Luap99

Luap99 commented Apr 22, 2022

@giuseppe

jqueuniet commented Apr 22, 2022

  • 👍 1 reaction

@siretart

siretart commented Apr 22, 2022 • edited

  • ❤️ 1 reaction

siretart commented Apr 23, 2022

Siretart commented apr 24, 2022.

I'm backporting upstream commit a42c131 which reverts the usage to the deprecated API. Initial testing confirms that this avoids the crash. Go figure! (pun intended)

@Luap99

No branches or pull requests

@giuseppe

IMAGES

  1. Panic: assignment to entry in nil map · Issue #13606 · docker/for-win

    docker panic assignment to entry in nil map

  2. Assignment To Entry In Nil Map

    docker panic assignment to entry in nil map

  3. panic: assignment to entry in nil map

    docker panic assignment to entry in nil map

  4. Panic: assignment to entry in nil map

    docker panic assignment to entry in nil map

  5. Assignment To Entry In Nil Map

    docker panic assignment to entry in nil map

  6. [issue] panic: assignment to entry in nil map · Issue #748

    docker panic assignment to entry in nil map

VIDEO

  1. How important is the role of family physician or the primary care physician in the management of the

  2. Classmates TBT '' Panic Button ''

  3. Docker Assignment

  4. Terra Nil

  5. Assignment 3-Docker Mindfulai

  6. Docker task Assignment

COMMENTS

  1. Panic: assignment to entry in nil map

    Panic: assignment to entry in nil map. ### Description When doing docker login in the command prompt / powershell, I g …. Hi all, a fix for this will be tracked on the docker/cli issue tracker: Nil pointer dereference on loading the config file · Issue #4414 · docker/cli · GitHub. Thank you!

  2. Runtime error: assignment to entry in nil map

    Map types are reference types, like pointers or slices, and so the value of m above is nil; it doesn't point to an initialized map. A nil map behaves like an empty map when reading, but attempts to write to a nil map will cause a runtime panic; don't do that.

  3. Panic: assignment to entry in nil map #13606

    Client: Version: 24.0.2 Context: default Debug Mode: false Plugins: buildx: Docker Buildx (Docker Inc.) Version: v0.11. Path: C: \P rogram Files \D ocker \c li-plugins \d ocker-buildx.exe compose: Docker Compose (Docker Inc.) Version: v2.19.1 Path: C: \P rogram Files \D ocker \c li-plugins \d ocker-compose.exe dev: Docker Dev Environments (Docker Inc.) Version: v0.1.0 Path: C: \P rogram Files ...

  4. win11 docker login 异常:panic: assignment to entry in nil map

    定义一个新的map,然后在map中添加键值对,却报了错误 assignment to entry in nil map val dataMa map[int]int dataMap[3]=7 golang中map是引用类型,应用类型的变量未初始化时默认的zero value是nil。直接向nil map写入键值数据会导致运行时错误panic: assignment to entry in nil map 因为在声明dataMap后并未初始化它,所以它的值是 ...

  5. "panic: assignment to entry in nil map" on SetAuthentication #972

    Description Modify auth.json fields leads to panic: assignment to entry in nil map Steps to reproduce the issue: success login image registry change auth.json fileds $ cat auth.json { "auths": { "m...

  6. panic: assignment to entry in nil map

    panic: assignment to entry in nil map where using BUILDX_GIT_LABELS=full with bake #1342 dgageot opened this issue Oct 4, 2022 · 0 comments · Fixed by #1343 Labels

  7. Assignment to Entry in Nil Map

    The block of code above specifies the kind of map we want (string: int), but doesn't actually create a map for us to use.This will cause a panic when we try to assign values to the map. Instead you should use the make keyword as outlined in Solution A.If you are trying to create a series of nested maps (a map similar to a JSON structure, for example), see Solution B.

  8. Go panics when writing to a nil map

    panic: assignment to entry in nil map. ... A nil map behaves like an empty map when reading, but attempts to write to a nil map will cause a runtime panic; don't do that.

  9. Go : assignment to entry in nil map

    The initial capacity does not bound its size: maps grow to accommodate the number of items stored in them, with the exception of nil maps. A nil map is equivalent to an empty map except that no elements may be added. You write: var countedData map[string][]ChartElement Instead, to initialize the map, write, countedData := make(map[string ...

  10. panic: assignment to entry in nil map #866

    macOS amd64 Docker; Other (please describe) Describe the issue. panic: assignment to entry in nil map. Describe how to replicate the issue. The connection from the publisher to the camera is not stable. Publisher tries to connect to the camera and i got this bug. Did you attach the server logs? yes. panic: assignment to entry in nil map ...

  11. Help: Assignment to entry in nil map · YourBasic Go

    panic: assignment to entry in nil map Answer. You have to initialize the map using the make function (or a map literal) before you can add any elements: m := make(map[string]float64) m["pi"] = 3.1416. See Maps explained for more about maps. Index; Next » Share this page: Go Gotchas » Assignment to entry in nil map; Invalid memory address or ...

  12. I've got an error with map

    assignment to entry in nil map. and correlate with the information about how to use maps in, for example, the tour.

  13. Go Runtime error: "assignment to entry in nil map"

    panic: assignment to entry in nil map. To make it work you have to initialize the map itself before to start to populate with indexes. state := &stateInformation{. columns: make(map[string]int), } Or another way to initialize: func (info *stateInformation) setColumns(record []string) {.

  14. Rancher Container is crashing with Observed a panic: "assignment to

    Rancher Container is randomly crashing with: Observed a panic: "assignment to entry in nil map" (assignment to entry in nil map) To Reproduce. What we have done: Upgrade the RKE Cluster to 1.21.8 (for Rancher) Upgrade Rancher from v2.5.11 to v2.6.3 via HELM; Upgrade the Windows Downstream RKE Cluster to k8s 1.21.8

  15. "assignment to entry in nil map" with simple interface assignment not

    var m map[string]string your m variable is assigned with a default value of map, which is nil, not an empty map. This is why you get that error, you are trying to add a value to a nil map. To initialize an empty map, you can try any of these: var m map[string]string = map[string]string{} m := make(map[string]string) m := map[string]string{}

  16. `panic: assignment to entry in nil map` at nested maps : r/golang

    above is i think the minimum you need to change to get your example working. but rather than constructing the map per id and then filling in the keys, just create a map literal and assign it to the id value, something like: var id int. Contests := make(map[string]map[string]map[string]map[string]string)

  17. panic: "assignment to entry in nil map" when try to create node by

    Saved searches Use saved searches to filter your results more quickly

  18. golang map of interface

    golang map of interface - panic: assignment to entry in nil map [duplicate] Ask Question Asked 8 years, 8 months ago. Modified 8 years, 8 months ago. Viewed 17k times 2 This question already has answers here: ...

  19. panic: assignment to entry in nil map #13968

    Go figure! (pun intended) Luap99 mentioned this issue on Apr 24, 2022. Panic when trying to run or start a container #13989. Closed. github-actions bot added the locked - please file new issue/PR label on Sep 20, 2023. github-actions bot locked as resolved and limited conversation to collaborators on Sep 20, 2023.