简体   繁体   English

bash:行:docker:找不到命令

[英]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 容器中使用 jenkins 并且想启动另一个实例,每当我尝试使用 docker 命令时

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通过阅读/root/.ash_history ,我可以清楚地看到虚拟机创建者能够使用 docker 命令

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 ENVIRONMENTAL #######################################环境信息:JENKINS_VOL=/var/lib/詹金斯 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 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 2016 年 5 月 16 日 /.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我毫无希望地尝试了许多 docker 命令

is it because that I'm already inside the container??是因为我已经在容器里了吗??

Try with docker run -t -i ap/dashboard /bin/ash .尝试使用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.也许你的容器不使用bash所以你应该尝试使用/bin/sh这是默认安装的 shell 处理器的符号链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM