Quantcast
Viewing all articles
Browse latest Browse all 14069

Bash not working properly when running Docker as non-root

I want to run a docker with a bash, when i was running with basic configuration it ran as root and it showed the terminal properly. But when i moved to non-root user now the terminal just shows $ and tab is not working, also it does not matter if i move in different folders it just shows the $

I am using a docker-compose.yml file for automatization of the process

here are the two files

Dockerfile

FROM python:3.10# Create non-root userRUN groupadd -r dsteam && useradd -r -g dsteam -m dsteam# Set the working directoryWORKDIR /home/dsteam/app/# Copy and install requirementsCOPY ./requirements.txt ./RUN pip install --no-cache-dir -r requirements.txt# Change directory ownershipRUN chown -R dsteam:dsteam /home/dsteam/app# Expose the portEXPOSE 5001# Switch to non-root userUSER dsteam# Copy the rest of the application codeCOPY . .# Run your command# CMD [ "uvicorn", "src.server.app:app", "--host", "0.0.0.0", "--port", "80", "--reload" ]

docker-compose.yml

version: '3'services:  aiproject:    build: .    image: aiproject-image    container_name: aiproject-container    ports:      - "80:80"    volumes:      - .:/app    stdin_open: true    tty: true    # Override the default command with bash    command: ["bash"]

Viewing all articles
Browse latest Browse all 14069

Trending Articles