containers / containers/podman-compose

container_name doens't work with build command - unable to find container example.com:example.com is a pod, not a container

Open
#144 4 comments 4 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
6.2k
Forks
622
PR merge metrics
No merged PRs in 30d

Description

Hey,

when I use the `build` argument together with `container_name` I get the following error:
```
podman pod create --name=example.com --share net -p 127.0.0.1:4000:3003
26c1220e39bfffd0d1f5eff52430836d27d5b2e27c84439dee178a1253d03c9f
0
podman create --name=example.com --pod=example.com -l io.podman.compose.config-hash=123 -l io.podman.compose.project=example.com -l io.podman.compose.version=0.0.1 -l com.docker.compose.container-number=1 -l com.docker.compose.service=example.com --mount type=bind,source=/var/www/example/example.com/.,destination=/usr/app --mount type=bind,source=/var/www/example/example.com/.,destination=/usr/app/node_modules --add-host example.com:127.0.0.1 --add-host example.com:127.0.0.1 example.com_example.com npm run dev
Error: name example.com is in use: container already exists
125
podman start -a example.com
Error: unable to find container example.com:example.com is a pod, not a container: no such container

```

When I remove the `container_name` argument, everything works as expected.

My docker-compose:
```
version: "3"

services:
example.com:
restart: always
build: .
command: npm run dev
container_name: example.com
volumes:
- .:/usr/app
ports:
- 127.0.0.1:4000:3003
```

My Dockerfile

```
FROM node:alpine

RUN apk update \
&& apk add \
git

WORKDIR /usr/app

COPY package.json .
RUN npm install --quiet
COPY . .
```

The command I run to reproduce the error:

`sudo podman-compose up`

Thank you very much

Kind regards
Thomas

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.