Skip to content

Instantly share code, notes, and snippets.

@jbodah
Created August 29, 2019 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbodah/14a38cbff2474feb40d223f308074723 to your computer and use it in GitHub Desktop.
Save jbodah/14a38cbff2474feb40d223f308074723 to your computer and use it in GitHub Desktop.
strace a container
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2cdef4202c1c cg-ruby-sem_sem "rails c" 19 minutes ago Up 19 minutes 3000/tcp cg-ruby-sem_sem_run_73d6529b9b23
$ cat Dockerfile.debug
FROM alpine
RUN apk update && apk add strace
CMD ["strace", "-p", "1"]
$ docker build -f Dockerfile.debug -t strace .
$ docker run -it --pid=container:2cdef4202c1c --net=container:2cdef4202c1c --cap-add sys_admin --cap-add sys_ptrace strace
strace: Process 1 attached
read(7,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment