diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..30fba74 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM fedora:25 + +MAINTAINER "Petr Hracek" + +LABEL summary="Provides a minimal set of packages used for debugging." +LABEL description="The Fedora Debugging Tools Container is a docker-formatted image that includes a minimal set of tools for troubleshooting and investigating a Fedora Host. Designed to run as a privileged container." +LABEL io.k8s.display-name="Fedora Debugging Tools Base" + +RUN dnf install -y --setopt=tsflags=nodocs \ + iputils \ + iproute \ + lsof \ + net-tools \ + passwd \ + strace \ + valgrind && \ + dnf -y clean all + +CMD ["/usr/bin/bash"] diff --git a/Makefile b/Makefile index 1e0d81c..c848573 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,17 @@ +.PHONY: build run default + IMAGE_NAME = debugging-tools +MODULEMDURL=file://debugging-tools.yaml + +all: run +default: run build: - docker build --tag=$(IAMGE_NAME) + docker build --tag=$(IMAGE_NAME) . run: build - docker run -d $(IMAGE_NAME) + docker run -it --name $(IMAGE_NAME) --privileged --ipc=host --net=host --pid=host -e HOST=/host -e NAME=$(IMAGE_NAME) -e IMAGE=$(IMAGE_NAME) -v /run:/run -v /var/log:/var/log -v /etc/machine-id:/etc/machine-id -v /etc/localtime:/etc/localtime -v /:/host $(IMAGE_NAME) -test: - cd tests; MODULE=docker URL="docker=$(IMAGE_NAME)" make all +test: build + cd tests; MODULE=docker MODULEMD=$(MODULEMDURL) URL="docker=$(IMAGE_NAME)" make all + cd tests; MODULE=rpm MODULEMD=$(MODULEMDURL) URL="docker=$(IMAGE_NAME)" make all diff --git a/README.md b/README.md index 7648c65..af3385b 100644 --- a/README.md +++ b/README.md @@ -1,94 +1,44 @@ -iproute dependencies -==================== +# debugging-tools-base +A minimal set of debugging tools so I can troubleshoot my running server. -build dependencies calculated by brt_dep_solver ------------------------------------------------ -bison -iptables -libmnl -linux-atm -linuxdoc-tools -psutils +The list of packages available in container is: -runtime dependencies calculated by brt_dep_solver -------------------------------------------------- -bison -iptables -libmnl -linux-atm -linuxdoc-tools -psutils + * iproute - Advanced IP routing and network device configuration tools + * iputils - Network monitoring tools including ping + * lsof - A utility which lists open files on a Linux/UNIX system + * net-tools - Basic networking tools + * passwd - An utility for setting or changing passwords using PAM - YES (no if we're not making container) + * strace - Tracks and displays system calls associated with a running process + * valgrind - Tool for finding memory management bugs in programs +## How to run the container for debugging -iputils dependencies -==================== +Pull container from DockerHub: -build dependencies calculated by brt_dep_solver ------------------------------------------------ -kernel +```bash +docker pull modularitycontainers/debugging-tools-base +``` -runtime dependencies calculated by brt_dep_solver ------------------------------------------------ -kernel +For running the container, use command: -net-tools dependencies -==================== - -build dependencies calculated by brt_dep_solver ------------------------------------------------ -net-tools dependencies -==================== - -build dependencies calculated by brt_dep_solver ------------------------------------------------ -bluez - -runtime dependencies calculated by brt_dep_solver ------------------------------------------------ -bluez - -passwd dependencies -==================== - -build dependencies calculated by brt_dep_solver ------------------------------------------------ -audit -libselinux -libuser - -run-time dependencies calculated by brt_dep_solver ------------------------------------------------ -audit -libselinux -libuser -pam - -strace dependencies -==================== - -build dependencies calculated by brt_dep_solver ------------------------------------------------ -libunwind - -run-time dependencies calculated by brt_dep_solver ------------------------------------------------ -libunwind +```bash +docker run -it --name NAME --privileged --ipc=host --net=host --pid=host -e HOST=/host -e NAME=NAME -e IMAGE=IMAGE -v /run:/run -v /var/log:/var/log -v /etc/machine-id:/etc/machine-id -v /etc/localtime:/etc/localtime -v /:/host debugging-tools-base +``` -valgrind dependencies -==================== +## How to extent the container with you set of tools for debugging -build dependencies calculated by brt_dep_solver ------------------------------------------------ -glibc -openmpi -perl-generators (part of perl module) +Write a Dockerfile: -run-time dependencies calculated by brt_dep_solver ------------------------------------------------ -glibc -openmpi -perl (part of perl module) -perl-generators (part of perl module) +```bash +FROM modularitycontainers/debugging-tool-base:latest +MAINTAINTER YOUR_NAME + +RUN INSTALL_PKSG=" " && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + dnf -y clean all +CMD ["/usr/bin/bash"] + +``` \ No newline at end of file diff --git a/debugging-tools.yaml b/debugging-tools.yaml index c9d6a48..8320dad 100644 --- a/debugging-tools.yaml +++ b/debugging-tools.yaml @@ -9,9 +9,12 @@ data: buildrequires: base-runtime: master # add common-build-dependencies - # common-build-dependencies: master + common-build-dependencies-bootstrap: f26 + common-build-dependencies: f26 + shared-userspace: f26 requires: base-runtime: master + shared-userspace: f26 references: community: https://fedoraproject.org/wiki/Modularity documentation: https://fedoraproject.org/wiki/Fedora_Packaging_Guidelines_for_Modules @@ -21,6 +24,7 @@ data: rpms: - iproute - iputils + # No dependencies - lsof - net-tools - passwd @@ -65,3 +69,36 @@ data: rationale: A dependency of tangerine. ref: master buildorder: 10 + libmnl: + rationale: A dependency of iproute. + ref: master + linux-atm: + rationale: A dependency of iproute. + ref: master + linuxdoc-tools: + rationale: A dependency of iproute. + ref: master + psutils: + rationale: A dependency of iproute. + ref: master + texlive: + rationale: A dependency of iproute. + ref: master + docbook-utils: + rationale: A dependency of iputils. + ref: master + perl-SGMLSpm: + rationale: A dependency of iputils. + ref: master + bluez: + rationale: A dependency of net-tools. + ref: master + libuser: + rationale: A dependency of passwd. + ref: master + libunwind: + rationale: A dependency of strace. + ref: master + openmpi: + rationale: A dependency of valgrind. + ref: master diff --git a/tests/Makefile b/tests/Makefile index 85768a2..8fd8ae7 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,12 +1,6 @@ -MODULE_LINT=/usr/lib/python2.7/site-packages/moduleframework/modulelint.py +MODULE_LINT=/usr/share/moduleframework/tools/modulelint.py CMD=python -m avocado run --filter-by-tags=-WIP $(MODULE_LINT) *.py # -generate: - generator - -check: +all: $(CMD) - - -all: generate check diff --git a/tests/config.yaml b/tests/config.yaml index da11991..3343ad4 100644 --- a/tests/config.yaml +++ b/tests/config.yaml @@ -1,24 +1,19 @@ document: modularity-testing version: 1 name: debugging-tools -modulemd-url: https://raw.githubusercontent.com/container-images/debugging-tools/master/debugging-tools.yaml +modulemd-url: http://raw.githubusercontent.com/container-images/debugging-tools-base/master/debugging-tools-base.yaml +source: https://github.com/container-images/debugging-tools-base packages: rpms: + - iproute - iputils - lsof + - net-tools + - passwd - strace -source: https://github.com/container-images/debugging-tools + - valgrind module: + docker: + source: https://github.com/container-images/debugging-tools-base.git + container: docker.io/modularitycontainers/debugging-tools-base rpm: - repos: - - http://mirror.vutbr.cz/fedora/releases/25/Everything/x86_64/os/ - - https://phracek.fedorapeople.org/debugging-tools-repo/ -test: - processrunning: - # Tests for iputils - - 'ls /usr/bin/ping' - - 'ls /usr/bin/tracepath' - # Tests for lsof - #- 'ls /usr/bin/lsof' - # Tests for strace - #- 'ls /usr/bin/strace' diff --git a/tests/simpleTest.py b/tests/simpleTest.py index 3b7b88b..c61193e 100644 --- a/tests/simpleTest.py +++ b/tests/simpleTest.py @@ -31,13 +31,39 @@ class simpleTests(module_framework.AvocadoTest): :avocado: enable """ - def testAssertIn(self): + def test_iputils(self): self.start() - # Tests for iputils - self.assertIn('Ping exists!', self.runHost('ls /usr/bin/ping').stdout) - self.assertIn('tracepath exists!', self.runHost('ls /usr/bin/tracepath').stdout) - # Tests for lsof - #self.assertIn('lsof exists!', self.runHost('ls /usr/bin/lsof').stdout) - # Tests for strace - #self.assertIn('strace exists!', self.runHost('ls /usr/bin/strace').stdout) + self.run('ls -al /usr/bin/ping') + self.run('ls -al /usr/bin/tracepath') + self.run('lsof /') + + def test_iproute(self): + self.start() + self.run('ls -al /usr/sbin/ip') + self.run('ls -al /usr/sbin/ifcfg') + x = self.run('/usr/sbin/ifcfg', ignore_status=True) + self.assertEqual(1, x.exit_status) + self.run('ls -al /usr/sbin/ifstat') + self.run('/usr/sbin/ifstat') + + def test_lsof(self): + self.run('lsof /') + + def test_net_tools(self): + self.run('ls -al /usr/sbin/route') + self.run('route') + self.run('ls -al /usr/bin/netstat') + self.run('netstat') + + def test_passwd(self): + self.run('ls -al /usr/bin/passwd') + self.run('passwd --help') + + def test_strace(self): + self.run('ls -al /usr/bin/strace') + self.run('strace -h') + + def test_valgrind(self): + self.run('ls -al /usr/bin/valgrind') + self.run('valgrind -h')