Show List

View Docker Application Server Files

In this demo we will see how to view the files on the container created through docker image.

Get the container id

First we need to get the name of the container where particular image is installed. Run command "docker container ls" to get the container.
C:\Users\mail2>docker container ls
CONTAINER ID   IMAGE             COMMAND                  CREATED        STATUS        PORTS                    NAMES
599bb3145263   sonatype/nexus3   "/opt/sonatype/nexus…"   20 hours ago   Up 20 hours   0.0.0.0:8081->8081/tcp   nexus

Start bash on the container

Run the command "docker exec -t -i 599bb3145263 /bin/bash" using the container id from above step
C:\Users\mail2\Downloads\gradle-sample-publish-jar\build\libs>docker exec -t -i 599bb3145263 /bin/bash
bash-4.4$

View the file list

Go to the top directory and list all the directories.
bash-4.4$ cd ..
bash-4.4$ ls
sonatype
bash-4.4$ cd ..
bash-4.4$ ls
bin   dev  home  lib64       media  nexus-data  proc  run   srv  tmp  var
boot  etc  lib   lost+found  mnt    opt         root  sbin  sys  usr

View the file content

You can go to the required directory/file and view the content using cat command
bash-4.4$ cd nexus-data
bash-4.4$ ls
admin.password  cache  elasticsearch  generated-bundles  javaprefs  keystores  log     port                 tmp
blobs           db     etc            instances          karaf.pid  lock       orient  restore-from-backup
bash-4.4$ cat admin.password
1ea1cca6-14c4-435c-9ede-56b648c1df63
bash-4.4$

    Leave a Comment


  • captcha text