Updated docker attach example.

The previous example was out of date. I changed the distro & pined the
tag to help prevent the new example from becoming out of date too.

Signed-off-by: Kelton Bassingthwaite <KeltonBassingthwaite@gmail.com>
This commit is contained in:
Kelton Bassingthwaite 2021-06-26 18:11:19 -06:00
parent 918168c40f
commit 384b59b735
1 changed files with 16 additions and 16 deletions

View File

@ -45,22 +45,22 @@ In this example the top command is run inside a container, from an image called
fedora, in detached mode. The ID from the container is passed into the **docker fedora, in detached mode. The ID from the container is passed into the **docker
attach** command: attach** command:
$ ID=$(sudo docker run -d fedora /usr/bin/top -b) $ ID=$(sudo docker run -d ubuntu:20.04 /usr/bin/top -b)
$ sudo docker attach $ID $ sudo docker attach $ID
top - 02:05:52 up 3:05, 0 users, load average: 0.01, 0.02, 0.05 top - 00:07:01 up 4:54, 0 users, load average: 0.83, 0.91, 0.82
Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.1%us, 0.2%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st %Cpu(s): 2.3 us, 1.6 sy, 0.0 ni, 95.9 id, 0.0 wa, 0.1 hi, 0.1 si, 0.0 st
Mem: 373572k total, 355560k used, 18012k free, 27872k buffers MiB Mem : 15846.2 total, 5729.2 free, 2592.5 used, 7524.4 buff/cache
Swap: 786428k total, 0k used, 786428k free, 221740k cached MiB Swap: 16384.0 total, 16384.0 free, 0.0 used. 12097.3 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 20 0 17200 1116 912 R 0 0.3 0:00.03 top 1 root 20 0 5976 3256 2828 R 0.0 0.0 0:00.04 top
top - 02:05:55 up 3:05, 0 users, load average: 0.01, 0.02, 0.05 top - 00:07:04 up 4:54, 0 users, load average: 0.76, 0.89, 0.81
Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.2%sy, 0.0%ni, 99.8%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st %Cpu(s): 2.0 us, 1.4 sy, 0.0 ni, 96.5 id, 0.0 wa, 0.1 hi, 0.0 si, 0.0 st
Mem: 373572k total, 355244k used, 18328k free, 27872k buffers MiB Mem : 15846.2 total, 5727.5 free, 2594.4 used, 7524.3 buff/cache
Swap: 786428k total, 0k used, 786428k free, 221776k cached MiB Swap: 16384.0 total, 16384.0 free, 0.0 used. 12095.6 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 20 0 17208 1144 932 R 0 0.3 0:00.03 top 1 root 20 0 5976 3256 2828 R 0.0 0.0 0:00.04 top