Unable to run bash on Docker

Asked 2 months ago, Updated 2 months ago, 358 views

I am thinking of creating a machine learning environment using Docker.
So I'm trying to build an environment using docker, but I can't run bash well.

After running docker-compose up,
docker-compose exec ml/bin/bash causes
ERROR—Displays No container found for ml_1.


after running docker-compose up or docker-compose up-d docker ps-a to check the container state, and it is exited.

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d67804c1bd66ml"/opt/nvidia/nvidia_…"9 minutes ago Exited(0)9 minutes ago desktop-ml-1

Additional
I checked and found that adding tty:true to docker-compose.yml won't stop the container, so I did it in addition to docker-compose.yml.

ERROR: 
        Can't find a sustainable configuration file in this directory or any
        parent.Are you in the right directory?

        Supported filenames: docker-compose.yml, docker-compose.yaml
        

appears and does not work.

What should I do?The host environment is CentOS.

Dockerfile

FROM nvcr.io/nvidia/pytorch:21.10-py3
WORKDIR/home/workspace
# COPY./home/workspace

COPY requirements.txt${PWD}
RUN pip install-r requirements.txt

docker-compose.yml

version: '2.3'
services:
  ml:
    build:.
    image —ml
    volumes:
      - .:/home/workspace
    command —bash
    deploy:
      resources:
        reservation:
          devices:
            - driver —nvidia
              count:1
              capabilities: [gpu]
    tty —true

linux docker

2022-11-21 04:13

1 Answers

Without docker-compose, -it was missing and could not enter bash.
The docker-compose method was resolved by adding tty:true to docker-compose.yml.

ERROR: 
        Can't find a sustainable configuration file in this directory or any
        parent.Are you in the right directory?

        Supported filenames: docker-compose.yml, docker-compose.yaml

The problem in was the wrong directory to run docker-compose.
Thank you.


2022-11-21 11:00

If you have any answers or tips


© 2023 OneMinuteCode. All rights reserved.