Passive Income
Passive Income

Reputation: 11

bash: line : docker: command not found

I am using jenkins in a docker container and would like to start another instance, whenever I try to use docker command like

docker run -t -i ap/dashboard /bin/bash 

I get this error:

bash: line 61: docker: command not found

How do I navigate to another container or solve this error?

I can clearly see that the vm creator was able to use the docker command by reading the /root/.ash_history

here are some details about the system:


[-] Specific release information:
3.3.1
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.3.1
PRETTY_NAME="Alpine Linux v3.3"
HOME_URL="http://alpinelinux.org"
BUG_REPORT_URL="http://bugs.alpinelinux.org"
 Hostname:
 b51cdbb7eebd

ENVIRONMENTAL ####################################### Environment information: JENKINS_VOL=/var/lib/jenkins JAVA_VERSION_BUILD=17 HOSTNAME=b51cdbb7eebd JAVA_VERSION_MAJOR=8 JENKINS_HOME=/opt/jenkins NLSPATH=/usr/dt/lib/nls/msg/%L/%N.cat PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/java/jre/bin JAVA_BASE=/usr/local/java PWD=/ JAVA_HOME=/usr/local/java/jre JAVA_PKG=server-jre LANG=C.UTF-8 XFILESEARCHPATH=/usr/dt/app-defaults/%L/Dt SHLVL=2 HOME=/root PKG_URL=https://circle-artifacts.com/gh/andyshinn/alpine-pkg-glibc/6/artifacts/0/home/ubuntu/alpine-pkg-glibc/packages/x86_64 JENKINS_VERSION=1.637 JAVA_VERSION_MINOR=66 _=/usr/bin/env


[-] Available shells:
# valid login shells
/bin/sh
/bin/ash
/bin/bash

[+] We can read root's home directory!
total 76
drwx------    5 root     root        4.0K Aug 28  2018 .
drwxr-xr-x    1 root     root        4.0K Nov 24 10:55 ..
-rw-------    1 root     root        3.1K Aug 29  2018 .ash_history
-rw-------    1 root     root         155 May 16  2016 .bash_history
drwxr-xr-x    2 root     root        4.0K May 12  2016 .oracle_jre_usage
drwx------    2 root     root        4.0K Aug 28  2018 .ssh
-rwxr-xr-x    1 root     root       46.0K Aug 28  2018 LinEnum.sh
drwxr-xr-x    3 root     root        4.0K May 12  2016 dockerfiles
-rw-r--r--    1 root     root           0 Aug 28  2018 foo

Looks like we're in a Docker container: 10:net_prio:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30 9:net_cls:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30 8:freezer:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30 7:devices:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30 6:memory:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30 5:blkio:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30 4:cpuacct:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30 3:cpu:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30 2:cpuset:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30 1:name=openrc:/docker -rwxr-xr-x 1 root root 0 May 16 2016 /.dockerenv


[-] Anything juicy in the Dockerfile:
-rw-r--r--    1 root     root           617 May 12  2016 /root/dockerfiles/jenkins/Dockerfile

I tried many docker commands without hope

is it because that I'm already inside the container??

Upvotes: 1

Views: 3563

Answers (1)

Antonio Petricca
Antonio Petricca

Reputation: 11040

Try with docker run -t -i ap/dashboard /bin/ash.

Maybe your container does not use bash so you should try with /bin/sh which is a symcolic link to the default installed shell processor.

Upvotes: 0

Related Questions