Open 2k16daniel opened 2 years ago
@2k16daniel is there anything in that config section that does contain the correct name?
@2k16daniel is there anything in that config section that does contain the correct name?
Yes, as you can see the container ID 8f6d82550054 has a correct name output both from docker container ls command and lazydocker
sorry I meant: for the phpmyadmin/db container, is there anything in the Config tab in the main panel that contains the sqlserver name? The idea being that we could make use of that
sorry I meant: for the phpmyadmin/db container, is there anything in the Config tab in the main panel that contains the sqlserver name? The idea being that we could make use of that
yes it has, at bottom part under "logPath" :
"Name" : "/sqlserver",
and this my docker inspect output of phpmyadmin/db container
[
{
"Id": "505619d7a839fba71ebf4e6f4fbfed5d2f5be08ce570e3f2a362dc5111663e94",
"Created": "2022-10-30T12:46:21.344838008Z",
"Path": "docker-entrypoint.sh",
"Args": [
"mysqld"
],
"State": {
"Status": "exited",
"Running": false,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 0,
"ExitCode": 255,
"Error": "",
"StartedAt": "2022-11-01T09:37:24.375951325Z",
"FinishedAt": "2022-11-07T20:03:36.666591482+08:00"
},
"Image": "sha256:15ff8bdcf37b2e994c63ed3f1294c1d5707346078eb54f282a35ce7b4524bee8",
"ResolvConfPath": "/media/potato/Docker/containers/containers/505619d7a839fba71ebf4e6f4fbfed5d2f5be08ce570e3f2a362dc5111663e94/resolv.conf",
"HostnamePath": "/media/potato/Docker/containers/containers/505619d7a839fba71ebf4e6f4fbfed5d2f5be08ce570e3f2a362dc5111663e94/hostname",
"HostsPath": "/media/potato/Docker/containers/containers/505619d7a839fba71ebf4e6f4fbfed5d2f5be08ce570e3f2a362dc5111663e94/hosts",
"LogPath": "/media/potato/Docker/containers/containers/505619d7a839fba71ebf4e6f4fbfed5d2f5be08ce570e3f2a362dc5111663e94/505619d7a839fba71ebf4e6f4fbfed5d2f5be08ce570e3f2a362dc5111663e94-json.log",
"Name": "/sqlserver",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "docker-default",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {
"3306/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "3307"
}
]
},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"CgroupnsMode": "private",
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "private",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": [],
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"DeviceCgroupRules": null,
"DeviceRequests": null,
"KernelMemory": 0,
"KernelMemoryTCP": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": null,
"PidsLimit": null,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": [
"/proc/asound",
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware"
],
"ReadonlyPaths": [
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": {
"LowerDir": "/media/potato/Docker/containers/overlay2/f8b6a404d122d6bb2d19bd1101e85ba3f122267e011c501e30fdd9c5aa52164b-init/diff:/media/potato/Docker/containers/overlay2/a77d5f4f9fbdd30f20f8bb55e1cce6c3363f75720bfdc7faea52618eeb1e074d/diff:/media/potato/Docker/containers/overlay2/6277fda01d912df8db7bae5a121955a706d6613a2b3e75b3c658278d23db20e8/diff:/media/potato/Docker/containers/overlay2/ff85960a56edf52db7e127ff9f1b5ae6bb79d98d3d2ae700c7bf6d937075c7f7/diff:/media/potato/Docker/containers/overlay2/2de8f666e0555c90def4f4270cf72ac9a3ba8312bf29faabae910101b96b5051/diff:/media/potato/Docker/containers/overlay2/af145b84a983861ecf8349fdc3260e5a41d9cbbfbace8ae89ba9bd1f95de9fc4/diff:/media/potato/Docker/containers/overlay2/e2dcdb4b3f573de6e3c50aa6cc99f64527137064cae54e1b356fcd2341042664/diff:/media/potato/Docker/containers/overlay2/c61badc4b65d79c7f0cbbeb1da36b5f75500db07b45e0ca0ecf329ce389b3ffb/diff:/media/potato/Docker/containers/overlay2/44d9efdcbe859ad6fc4a8c4ab3b5380920e9e8097246936289247df698e880dc/diff:/media/potato/Docker/containers/overlay2/61e8925667c9f421ce0f6cc0f38d6c9ba3f983e158e56bacb0a359157b73b5f4/diff:/media/potato/Docker/containers/overlay2/be98e69ddb0a525b050679bc00275ac154de9bbd2727ff6aeaf5fcdc2cd7f66f/diff:/media/potato/Docker/containers/overlay2/f53737e99f2c5c9c23bf2916205c9ab0504ce0b95ef05de7c3642b4957d0e477/diff:/media/potato/Docker/containers/overlay2/74b0596298a305a829dab75b11eab28d8d57b70c3d7e5dd7a6a32b1e5de69703/diff",
"MergedDir": "/media/potato/Docker/containers/overlay2/f8b6a404d122d6bb2d19bd1101e85ba3f122267e011c501e30fdd9c5aa52164b/merged",
"UpperDir": "/media/potato/Docker/containers/overlay2/f8b6a404d122d6bb2d19bd1101e85ba3f122267e011c501e30fdd9c5aa52164b/diff",
"WorkDir": "/media/potato/Docker/containers/overlay2/f8b6a404d122d6bb2d19bd1101e85ba3f122267e011c501e30fdd9c5aa52164b/work"
},
"Name": "overlay2"
},
"Mounts": [
{
"Type": "volume",
"Name": "02e4b516b262d9a2070b734fd1abca5a9b782b0bd15ffc0260ba85b89cc7417b",
"Source": "/media/potato/Docker/containers/volumes/02e4b516b262d9a2070b734fd1abca5a9b782b0bd15ffc0260ba85b89cc7417b/_data",
"Destination": "/var/lib/mysql",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
}
],
"Config": {
"Hostname": "505619d7a839",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"3306/tcp": {},
"33060/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"MYSQL_ROOT_PASSWORD=password",
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"GOSU_VERSION=1.14",
"MYSQL_MAJOR=8.0",
"MYSQL_VERSION=8.0.31-1.el8",
"MYSQL_SHELL_VERSION=8.0.31-1.el8"
],
"Cmd": [
"mysqld"
],
"Image": "hsheth2/mysql-low-memory",
"Volumes": {
"/var/lib/mysql": {}
},
"WorkingDir": "",
"Entrypoint": [
"docker-entrypoint.sh"
],
"OnBuild": null,
"Labels": {}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "da622969bd0f180dfb02995056a85dfb7911b70ff561b6d66c2418c4a2b6aa6c",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"3306/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "3307"
}
],
"33060/tcp": null
},
"SandboxKey": "/var/run/docker/netns/da622969bd0f",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "375cf2b0f16e9cfde285073a7757c9beba44d4f81fd7573f2d49393efcce31b6",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:02",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "e37944beea9fa39946b69a29b7a1807e7462c9f55f64a9d7f7cf4969251f3ad1",
"EndpointID": "375cf2b0f16e9cfde285073a7757c9beba44d4f81fd7573f2d49393efcce31b6",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:02",
"DriverOpts": null
}
}
}
}
]
Interesting, so sounds like if there is a name in the config we should use that
in pkg/commands/docker.go
we have:
// if the container is made with a name label we will use that
if name, ok := container.Labels["name"]; ok {
newContainer.Name = name
} else {
newContainer.Name = strings.TrimLeft(container.Names[0], "/")
}
Does your container have a 'name' label?
in
pkg/commands/docker.go
we have:// if the container is made with a name label we will use that if name, ok := container.Labels["name"]; ok { newContainer.Name = name } else { newContainer.Name = strings.TrimLeft(container.Names[0], "/") }
Does your container have a 'name' label?
Sorry What do you mean bout 'name' label? Forgive me, English isn't my Native language. And also for late reply Its a busy week for me.
Here's what I did,
I passed a flag --name with "sqlserver" when I created the container mysql-low-memory image
About phpmyadmin image, i also passed a --name flag with phpmyadmin as value, Idunno where the "phpmyadmin/db" came from, i dont think that's the name of the image itself
I have a container where the base image has a "name" label. I would prefer if the actual container name was used in Lazygit instead of the base image "name" label.
I have the same issue with Kafka:
version: "3.4"
kafka:
image: confluentinc/cp-kafka:7.3.0
This kafka image has a label of cp-kafka
. I could change the label with:
version: "3.4"
kafka:
image: confluentinc/cp-kafka:7.3.0
labels:
name: kafka
Which sort of fixes the issue, but actually the name displayed in LazyDocker should be folder-name-kafka-1
, where folder-name
is the name of the folder that the docker-compose.yml
file is.
Describe the bug Lazydocker displaying wrong container name, even on Config tab
Expected behaviour Container name has to be the same with "docker container ls" output
Screenshots Output by docker
lazydocker
Desktop (please complete the following information):