Reputation: 448
I'm creating an image via docker compose, but for some reason the name is getting doubled?
Everything is working great, and there are not problems, but the image names looks like 'poc_tool_poc_tool" How can I change the name? or add versioning?
docker ps:
c70753c4553e poc_tool_poc_tool "streamlit run --ser…" 17 minutes ago Up 11 minutes 0.0.0.0:8889->8889/tcp poc_tool_poc_tool_1
The project is built as follows:
- poc_tool
- app1
- app2
- app3
- docker-compose.yml
- Dockerfile
Dockerfile:
FROM python:3.8-slim-buster AS build
COPY app3 /app
COPY app1/src /app/src
COPY app2 /app/app2
WORKDIR /app
RUN pip install -r requirements.txt
EXPOSE 8889
ENTRYPOINT ["streamlit","run","--server.port","8889"]
CMD ["app.py"]
docker-compose:
version: "3"
services:
poc_tool:
build: .
volumes:
...
ports:
- "8889:8889"
Upvotes: 1
Views: 4374
Reputation: 620
for versioning your docker images, you can use docker tag
as below.
docker tag registry.example.com/OlderName registry.example.com/NewName:Version
Upvotes: 1
Reputation: 651
docker rename CONTAINER NEW_NAME
also check this for naming it in docker-compose
How to set image name in Dockerfile?
Upvotes: 3
Reputation: 158647
Compose generates its own names for most things, and it usually does this by combining the project name (by default, the name of the current directory) with the name in the docker-compose.yml
file. If you look at docker ps
output, you'll probably see a container named poc_tool_poc_tool_1
; if you look at docker network ls
, you'll see poc_tool_default
; and if you had named volumes, they'd also have this prefix.
In the docker-compose.yml
file, it's valid to specify both build:
and image:
. If you do, then docker-compose build
uses the image:
name instead of generating its own.
version: "3"
services:
poc_tool:
build: .
image: registry.example.com/name/poc_tool:${TAG:-latest}
(Style-wise, this means you don't generally need to include the project name as part of your Compose service names. It also means it's important to not name image:
as the base image of your Dockerfile, since Compose will happily overwrite it with your application code.)
Upvotes: 7