shell bash:行:Docker:找不到命令[重复]

yshpjwxd  于 2022-11-25  发布在  Shell
关注(0)|答案(1)|浏览(245)

This question already has answers here:

Docker not found when building docker image using Docker Jenkins container pipeline (7 answers)
Closed 7 hours ago.
This post was edited and submitted for review 7 hours ago.
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??

lb3vh1jj

lb3vh1jj1#

尝试使用docker run -t -i ap/dashboard /bin/ash
也许你的容器没有使用bash,所以你应该尝试使用/bin/sh,这是一个到默认安装的shell处理器的符号链接。

相关问题