Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't replace container after building a new Dockerfile image #1053

Open
Knyffen opened this issue Oct 3, 2024 · 1 comment
Open

Doesn't replace container after building a new Dockerfile image #1053

Knyffen opened this issue Oct 3, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Knyffen
Copy link

Knyffen commented Oct 3, 2024

Describe the bug
I have a project with a custom Dockerfile.
If I update the Dockerfile without updating docker-compose.yml and run sudo podman-compose up --build then the new image is built, but it doesn't replace the current container with one using the new image. Instead it prints the warning

Error: creating container storage: the container name "test_podman_compose_python_1" is already in use by 6cbc30b3bcd7130e7dbaf63fdeab8c8652b09385ec39c5035ff6bbd3a03abdf6. You have to remove that container to be able to reuse that name: that name is already in use, or use --replace to instruct Podman to do so.

To Reproduce
A directory with the following three files is sufficient:
docker-compose.yml:

services:
  python:
    build: .
    command: python -m pip list

Dockerfile:

# pull official base image
FROM docker.io/python:alpine3.20

# install python dependencies
RUN pip install --upgrade pip
# RUN pip install numpy # <-- uncomment this

# copy entrypoint.sh
COPY ./entrypoint.sh /usr/local/bin/
RUN sed -i "s/\r$//g" /usr/local/bin/entrypoint.sh \
    && chmod +x /usr/local/bin/entrypoint.sh

# run entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

entrypoint.sh:

#!/bin/sh
exec "$@"

You should then

  1. Run sudo podman-compose up --build
  2. Uncomment # RUN pip install numpy # <-- uncomment this
  3. Run sudo podman-compose up --build

Expected behavior
It should print

[python] | Package Version
[python] | ------- -------
[python] | pip     24.2

followed by

[python] | Package Version
[python] | ------- -------
[python] | numpy   2.1.1
[python] | pip     24.2

NOTE: This is the current behaviour of docker-compose.

Actual behavior
It prints

[python] | Package Version
[python] | ------- -------
[python] | pip     24.2

followed by

[python] | Package Version
[python] | ------- -------
[python] | pip     24.2

Environment:

  • OS: Linux
  • podman version: 5.2.3
  • podman compose version: 1.2.0 (release version)
@Knyffen Knyffen added the bug Something isn't working label Oct 3, 2024
@anterof5
Copy link

anterof5 commented Oct 23, 2024

Even here, my code has fixes for dynamic frame resolution, even using stop, rm, build, up, the fixes are not reflected.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants