Skip to content

Instantly share code, notes, and snippets.

@mrjohannchang
Forked from lox/docker-enter
Last active August 29, 2015 14:07
Show Gist options
  • Save mrjohannchang/08c051888929f934d5e7 to your computer and use it in GitHub Desktop.
Save mrjohannchang/08c051888929f934d5e7 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "You must be root to execute this script" 2>&1
else
PID=$(docker inspect --format "{{ .State.Pid }}" "$1")
nsenter --target $PID --mount --uts --ipc --net --pid
fi
#!/bin/bash
set -e
curl -o util-linux_2.24-1~1_amd64.deb "http://ppa.launchpad.net/78luphr0rnk2nuqimstywepozxn9kl19tqh0tx66b5dki1xxsh5mkz9gl-launchpad-a811i2i3ytqlsztthjth0svbccw8inm65tmkqp9sarr553jq53in4xm1m/util-linux/ubuntu/pool/main/u/util-linux/util-linux_2.24-1~1_amd64.deb"
sudo dpkg --install --ignore-depends=libblkid1,libmount1,libsmartcols1 --force-overwrite util-linux_2.24-1~1_amd64.deb
sudo curl -o /usr/local/bin/docker-enter https://gist.githubusercontent.com/lox/d210a74d3c2f317786ab/raw/docker-enter
sudo chmod +x /usr/local/bin/docker-enter
@mrjohannchang
Copy link
Author

dpkg: regarding util-linux_2.24-1~1_amd64.deb containing util-linux, pre-dependency problem:
 util-linux pre-depends on libblkid1 (>= 2.22-0)
  libblkid1:amd64 is installed, but is version 2.20.1-5.1ubuntu20.2.

dpkg: warning: ignoring pre-dependency problem!
dpkg: regarding util-linux_2.24-1~1_amd64.deb containing util-linux, pre-dependency problem:
 util-linux pre-depends on libmount1 (>= 2.24-1~1)
  libmount1:amd64 is installed, but is version 2.20.1-5.1ubuntu20.2.

dpkg: warning: ignoring pre-dependency problem!
(Reading database ... 246930 files and directories currently installed.)
Preparing to unpack util-linux_2.24-1~1_amd64.deb ...
Unpacking util-linux (2.24-1~1) over (2.20.1-5.1ubuntu20.2) ...
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/bin/last', which is also in package sysvinit-utils 2.88dsf-41ubuntu6
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/bin/mesg', which is also in package sysvinit-utils 2.88dsf-41ubuntu6
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/man/man1/last.1.gz', which is also in package sysvinit-utils 2.88dsf-41ubuntu6
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/man/man1/mesg.1.gz', which is also in package sysvinit-utils 2.88dsf-41ubuntu6
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/man/man1/lastb.1.gz', which is also in package sysvinit-utils 2.88dsf-41ubuntu6
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/man/man8/nologin.8.gz', which is also in package login 1:4.1.5.1-1ubuntu9
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/bash-completion/completions/look', which is also in package bash-completion 1:2.1-4
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/bash-completion/completions/renice', which is also in package bash-completion 1:2.1-4
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/bash-completion/completions/eject', which is also in package bash-completion 1:2.1-4
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/bash-completion/completions/cal', which is also in package bash-completion 1:2.1-4
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to ovepkg: regarding util-linux_2.24-1~1_amd64.deb containing util-linux, pre-dependency problem:
 util-linux pre-depends on libblkid1 (>= 2.22-0)
  libblkid1:amd64 is installed, but is version 2.20.1-5.1ubuntu20.2.

dpkg: warning: ignoring pre-dependency problem!
dpkg: regarding util-linux_2.24-1~1_amd64.deb containing util-linux, pre-dependency problem:
 util-linux pre-depends on libmount1 (>= 2.24-1~1)
  libmount1:amd64 is installed, but is version 2.20.1-5.1ubuntu20.2.

dpkg: warning: ignoring pre-dependency problem!
(Reading database ... 246930 files and directories currently installed.)
Preparing to unpack util-linux_2.24-1~1_amd64.deb ...
Unpacking util-linux (2.24-1~1) over (2.20.1-5.1ubuntu20.2) ...
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/bin/last', which is also in package sysvinit-utils 2.88dsf-41ubuntu6
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/bin/mesg', which is also in package sysvinit-utils 2.88dsf-41ubuntu6
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/man/man1/last.1.gz', which is also in package sysvinit-utils 2.88dsf-41ubuntu6
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/man/man1/mesg.1.gz', which is also in package sysvinit-utils 2.88dsf-41ubuntu6
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/man/man1/lastb.1.gz', which is also in package sysvinit-utils 2.88dsf-41ubuntu6
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/man/man8/nologin.8.gz', which is also in package login 1:4.1.5.1-1ubuntu9
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/bash-completion/completions/look', which is also in package bash-completion 1:2.1-4
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/bash-completion/completions/renice', which is also in package bash-completion 1:2.1-4
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/bash-completion/completions/eject', which is also in package bash-completion 1:2.1-4
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/bash-completion/completions/cal', which is also in package bash-completion 1:2.1-4
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/bash-completion/completions/su', which is also in package bash-completion 1:2.1-4
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/bash-completion/completions/dmesg', which is also in package bash-completion 1:2.1-4
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/bash-completion/completions/hexdump', which is also in package bash-completion 1:2.1-4
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/bin/lastb', which is also in package sysvinit-utils 2.88dsf-41ubuntu6
Setting up util-linux (2.24-1~1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for install-info (5.2.0.dfsg.1-2) ...
Processing triggers for mime-support (3.54ubuntu1) ...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   215    0   215    0     0    238      0 --:--:-- --:--:-- --:--:--   238
rwrite '/usr/share/bash-completion/completions/su', which is also in package bash-completion 1:2.1-4
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/bash-completion/completions/dmesg', which is also in package bash-completion 1:2.1-4
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/bash-completion/completions/hexdump', which is also in package bash-completion 1:2.1-4
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/bin/lastb', which is also in package sysvinit-utils 2.88dsf-41ubuntu6
Setting up util-linux (2.24-1~1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for install-info (5.2.0.dfsg.1-2) ...
Processing triggers for mime-support (3.54ubuntu1) ...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   215    0   215    0     0    238      0 --:--:-- --:--:-- --:--:--   238

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment