Home > Net >  login inside a docker container in oder to debug
login inside a docker container in oder to debug

Time:10-30

I use a docker container in the following way:

# download/pull the image from docker hub
$ docker pull nextgenusfs/funannotate

# download bash wrapper script (optional)
$ wget -O funannotate-docker https://raw.githubusercontent.com/nextgenusfs/funannotate/master/funannotate-docker

# might need to make this executable on your system
$ chmod  x /path/to/funannotate-docker

# assuming it is in your PATH, now you can run this script as if it were the funannotate executable script
$ funannotate-docker test -t predict --cpus 12

Unfortunately, with my own data, one of the tools crashes. How is it possible to execute the container and login inside it in order to run the tools manually in the hope of more information on why it crashed?

Thank you in advance,

CodePudding user response:

If the container keeps running you can use docker exec -ti <containername> bash (or sh) to execute a shell inside your container with an interactive terminal.

Maybe you can also add a shell or command with docker run [OPTIONS] IMAGE[:TAG] [COMMAND] [ARG...]

This worked for me

# docker run -ti nextgenusfs/funannotate bash
root@7b3db18d1ca9:/# ls
bin   etc                    lib    mnt   root  srv  usr
boot  funannotate-setup.log  lib64  opt   run   sys  var
dev   home                   media  proc  sbin  tmp  venv
root@7b3db18d1ca9:/#

CodePudding user response:

from funannotate-docker script:

docker run --rm "${IT[@]}" --user "${USER}" -e TZ="${TZ}" --workdir "${WORKDIR}" --mount "${MOUNT}" nextgenusfs/funannotate:latest funannotate "$@"

You can edit this script and add echo this line before it runs (maybe you will see something wrong in the command's arguments).

Then you can manually run it with bash instead of funannotate "$@" at the end (assuming the container is crushing too quickly and you can't exec while it is running).

  • Related