Skip to content

andriisoldatenko/debugging-containerized-go-applications

Folders and files

NameName
Last commit message
Last commit date

Latest commit

893980c · Sep 26, 2023

History

13 Commits
Sep 25, 2023
Sep 25, 2023
Sep 24, 2023
Sep 26, 2023
Sep 25, 2023
Sep 25, 2023
Jul 30, 2019
Sep 16, 2023
Sep 25, 2023
Sep 24, 2023
Sep 24, 2023
Sep 24, 2023
Sep 25, 2023
Sep 25, 2023
Sep 26, 2023
Sep 24, 2023
Sep 24, 2023
Sep 24, 2023
Sep 17, 2023

Repository files navigation

debug dockerized Go application using Delve

Sample-app

Just hello world

make build-sample-app
make run-sample-app

Debug inside docker via delve:

Note: If you are trying to debug linux/amd64 containers on m1 echo $DOCKER_DEFAULT_PLATFORM linux/amd64 you need to revisit docker/for-mac#5191 (comment)

export DOCKER_DEFAULT_PLATFORM="" 
docker build -t dlv-debug -f Dockerfile-dlv-debug .
docker run -it dlv-debug
/usr/src/app # dlv debug
Type 'help' for list of commands.
(dlv) b main.main
Breakpoint 1 set at 0xb9d80 for main.main() ./hello.go:9
(dlv) c
> main.main() ./hello.go:9 (hits goroutine(1):1 total:1) (PC: 0xb9d80)
     4:         "fmt"
     5:
     6:         "rsc.io/quote"
     7: )
     8:
=>   9: func main() {
    10:         nums := []int{2, 3, 4}
    11:         t := dummy
    12:         _ = t
    13:         for i, num := range nums {
    14:                 if num == 3 {
(dlv)

Links

About

Different debug examples for dockerized Go application

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published