Run docker with the python:3.12.8
image in an interactive mode, use the entrypoint bash
.
What's the version of pip
in the image?
Answer: 24.3.1
To run a Docker container with the python:3.12.8
image in interactive mode and set the entrypoint to bash
, you can use the following command:
docker run -it --entrypoint bash python:3.12.8
Here’s what each part does:
it
: Runs the container in interactive mode (i
) and allocates a pseudo-TTY (t
), allowing you to interact with the container.-entrypoint bash
: Overrides the default entrypoint of the image and sets it to bash
, so the container will start with a bash shell.python:3.12.8
: Specifies the Docker image to use.This will drop you into a bash shell inside the container, where you can execute commands interactively.
To check the version of pip
inside the Docker container using bash
, you can run the following command:
pip --version
#or
pip -V
This will display the version of pip
installed in the container.
Given the following docker-compose.yaml
, what is the hostname
and port
that pgadmin should use to connect to the postgres database?
services:
db:
container_name: postgres
image: postgres:17-alpine
environment:
POSTGRES_USER: 'postgres'POSTGRES_PASSWORD: 'postgres'POSTGRES_DB: 'ny_taxi'ports:
- '5433:5432'volumes:
- vol-pgdata:/var/lib/postgresql/data
pgadmin:
container_name: pgadmin
image: dpage/pgadmin4:latest
environment:
PGADMIN_DEFAULT_EMAIL: "[email protected]"PGADMIN_DEFAULT_PASSWORD: "pgadmin"ports:
- "8080:80"volumes:
- vol-pgadmin_data:/var/lib/pgadmin
volumes:
vol-pgdata:
name: vol-pgdata
vol-pgadmin_data:
name: vol-pgadmin_data