1

I'm executing a command docker ps -a | grep <imagename> from another container.

It shows

sh: grep: command not found
sh: docker: command not found

Can anyone support me on it?

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on https://superuser.com. – Reporter Aug 21 '17 at 13:32
  • 1
    @reporter, [Docker](https://www.docker.com/) questions are certainly on-topic here. – ChrisGPT was on strike Aug 21 '17 at 13:41
  • What are you trying to do? Are you trying to run Docker inside of Docker? – ChrisGPT was on strike Aug 21 '17 at 13:42
  • @Chris The tooltip says "Questions about how Docker interacts with programming or programming with Docker containers is on-topic. General support questions for Docker the application may be off topic and better asked on https://superuser.com.". The questioner want to access within a container to another container with a shell command. In my eyes it is an off-topic question. Maybe I am wrong. – Reporter Aug 21 '17 at 13:56
  • 1
    I believe this question is on topic but lacks enough detail to be answered. Please update the question with what image you are running, and how. Include enough detail that someone else could reproduce your error without access to your environment. – BMitch Aug 21 '17 at 15:10
  • I have an application (Application1) which executes 'docker ps -a | grep '. With Application1, I create an image say 'Image1'. On running 'Image1', it shows sh: grep: command not found sh: docker: command not found Need support on it. – Parthiban Karuppiah Aug 22 '17 at 12:47
  • I have an application (Application1) which executes 'docker ps -a | grep '. With Application1, I create an image say 'Image1'. On running 'Image1', it shows sh: grep: command not found sh: docker: command not found Need support on it. – Parthiban Karuppiah Aug 22 '17 at 12:51

2 Answers2

0

When you create image1, depending on its base image:

So start by checking those two factors.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

If you are searching for an image name, you can try:

docker ps --filter ancestor=image_name


If you are searching for a container name, you can try:

docker ps --filter "name=container_name"


But the fellas are right, if you don't have docker installed on that container, you won't be able to execute the docker ps command.

Jensen
  • 199
  • 2
  • 11