Comments (14)
I see your problem
- you customized container_name and podman-compose does not seem to support that
- you use container_name to communicate instead of service name
I'll fix it from my side
from podman-compose.
cool, thank you for the impl.
there are a few small things i had to change to get build
to work with my docker-compose
file:
- rename
dockerfile
s toDockerfile
- add the
context
map entry
before:after:build: containers/web
build: context: containers/web
an --pull-always
argument would be also nice-to-have.
Is there a way to get the logs?
The default behavior of docker-compse up
is to run in the foreground and forward the logs to the current terminal.
from podman-compose.
rename
dockerfile
toDockerfile
does compose look for both Dockerfile
and dockerfile
? because I think the default is Dockerfile
with capital D
.
if both, then which order?
build: containers/web
I did not know about this, can you point the document
The default behavior of docker-compse up is to run in the foreground and forward the logs to the current terminal.
it's planned
from podman-compose.
maybe it's not worth the time, those are just small changes in the config file
from podman-compose.
my objective is to run unmodified docker-compose.yml
from podman-compose.
Hi,
I don't know if it is related but I have also some difficulties to run a docker-compose which is using a build
step. Here is the docker-compose file. I tried to build the container before and change the context following the advice above but I still have some errors using :
python ../podman-compose/podman-compose.py -t 1podfw -f docker-compose.yml up
Podman is in version 1.2.0.
from podman-compose.
I'll look into it.
from podman-compose.
@remyd1 I've tried it with latest podman-compose
and it seems working fine
$ ../podman-compose/podman-compose.py build
podman build -t wicopa_web -f .docker/web/Dockerfile .docker/web
STEP 1: FROM alpine:3.9
Getting image source signatures
Copying blob bdf0201b3a05 [======================================] 2.6MiB / 2.6MiB
Copying config cdf98d1859 [======================================] 1.5KiB / 1.5KiB
Writing manifest to image destination
Storing signatures
STEP 2: LABEL Author remyd1 - https://github.com/remyd1
--> 474075012c8dfa9c02a9140b5652d9ca8e0d12254c79d4b2ee17e9c6de462a4d
STEP 3: FROM 474075012c8dfa9c02a9140b5652d9ca8e0d12254c79d4b2ee17e9c6de462a4d
STEP 4: RUN apk --update add php-apache2 php7-session php7-mysqli && rm -f /var/cache/apk/*
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
(1/17) Installing php7-common (7.2.18-r0)
(2/17) Installing libuuid (2.33-r0)
(3/17) Installing apr (1.6.5-r0)
(4/17) Installing expat (2.2.6-r0)
(5/17) Installing apr-util (1.6.1-r5)
(6/17) Installing pcre (8.42-r1)
(7/17) Installing apache2 (2.4.39-r0)
Executing apache2-2.4.39-r0.pre-install
...
$ ../podman-compose/podman-compose.py up
podman run --name=wicopa_db_1 -d --pod=wicopa -l io.podman.compose.config-hash=123 -l io.podman.compose.project=wicopa -l io.podman.compose.version=0.0.1 -l com.docker.compose.container-number=1 -l com.docker.compose.service=db -e MYSQL_ROOT_PASSWORD=w1c0Pa5s -e MYSQL_DATABASE=wicopa -e MYSQL_USER=wicopauser -e MYSQL_PASSWORD=w1c0Pa5s -v /data/mysql/wicopa:/var/lib/mysql:z -v /home/demo/wicopa/wicopa.sql:/docker-entrypoint-initdb.d/wicopa.sql:z --add-host web:127.0.0.1 --add-host wicopa_web_1:127.0.0.1 --add-host db:127.0.0.1 --add-host wicopa_db_1:127.0.0.1 --expose 3306 mariadb:10.3
Error: error checking path "/data/mysql/wicopa": stat /data/mysql/wicopa: no such file or directory
Error: error checking path "/home/demo/wicopa/wicopa.sql": stat /home/demo/wicopa/wicopa.sql: no such file or directory
so the reason it did not work that I don't have copy wicopa.sql
and because the absolute path /daya/mysql
is not part of the project nor relative
so it seems fine as far as podman-compose
is concerned
if you feel otherwise please let me know
from podman-compose.
Hi,
I tried what you did here. I created the full path /data/mysql/wicopa
and each time, it ended with Permission denied
although I changed the owner to my current podman-compose user and did a chmod 777.
Indeed, I have the following SElinux
errors (on fedora 29
):
SELinux: mount invalid. Same superblock, different security settings for (dev mqueue, type mqueue)
SELinux: mount invalid. Same superblock, different security settings for (dev mqueue, type mqueue)
SELinux: mount invalid. Same superblock, different security settings for (dev mqueue, type mqueue)
...
I found this related bug.
So, my understanding of this, is that podman-compose do not understand the :z
option in my docker-compose file. Indeed, this docker-compose works fine with the original docker-compose.
Anyway, if I am creating a relative path, as you suggested, I can bypass these errors, however, even if the mariadb container is now working and running, the web application is not able to connect to the DB.
The DB is full, but I think the network namespace is not shared between the containers. Am I right ? Should I add a networks
section to my docker-compose to get it work with podman-compose (it works as is with docker-compose) ?
from podman-compose.
So, my understanding of this, is that podman-compose do not understand the
:z
option in my docker-compose file. Indeed, this docker-compose works fine with the original docker-compose.
podman-compose
do support:z
and do pass it topodman
- both
podman-compose
anddocker-composer
are just wrappers aroundpodman run
anddocker run
respectively podman-compose
prints correspondingpodman run
commands that it uses, if you think it passes something wrong then it's a bug inpodman-compose
but if it's passed correctly then it's something else (podman not supporting something, rootless containers issue, your environment issues, ...etc.)
but you need to understand key differences between podman and docker
with docker there is a daemon running as root having full access to host machine
with podman there is no daemon and in my case podman is running as normal user
if your setup have a docker group and as non-root you can talk to docker daemon and type docker run
.
you should not but if you do keep in mind that when you type docker run
as non-root it just pass that command to the daemon which is running as root (which have enough privileges to do what you want).
another thing you need to know, that /data/mysql/wicopa/
is not something standard, I don't know who is the owner of that directory or what are SELinux context. Here is an example from my laptop (passing -Z
to ls
to see the SELinux context)
[root@laptop ~]# ls -lZd /var/lib/mysql/
drwxr-xr-x. 2 mysql mysql system_u:object_r:mysqld_db_t:s0 4096 Feb 19 00:54 /var/lib/mysql/
[root@laptop ~]# ls -lZd /var/lib/mongodb
drwxr-xr-x. 4 mongodb root system_u:object_r:mongod_var_lib_t:s0 4096 Apr 10 17:22 /var/lib/mongodb
so I'm not aware of your setup, ...etc but as far as podman-compose
is concerned, it passes all need information to podman
including :z
if any.
If you still have issues it's not with podman-compose
.
Am I right ? Should I add a networks section to my docker-compose to get it work with podman-compose (it works as is with docker-compose) ?
no, you don't need to do any change.
in the default mode podman-compose
creates a single pod with shared network space and runs all containers in that pod so that all containers in that compose file (or that pod) talk to each other via localhost
and adds hosts entries so that the names used by docker-compose
resolves to localhost (which is the pod not the host machine), in your case it's wicopaweb and wicopadb in /etc/hosts will point to localhost so that they discover each other by name
from podman-compose.
docker-compose created that directory with this context
$ ls -lhZd .docker/db/wicopa/
drwxrwxr-x. someuser somegroup system_u:object_r:container_file_t:s0 .docker/db/wicopa/
and similarly podman volume create myvol
$ ls -lhZd /home/demo/.local/share/containers/storage/volumes/myvol/_data
drwxr-xr-x. 2 myuser mygroup system_u:object_r:container_file_t:s0 4.0K May 14 00:51 /home/demo/.local/share/containers/storage/volumes/myvol/_data
from podman-compose.
Thanks for the clarifications.
However, I am sorry, but I am still unable to connect to the DB (using relative paths).
I am using python 2.7.15.
Here is what I get:
git clone https://gitlab.mbb.univ-montp2.fr/jlopez/wicopa.git
cd wicopa
✔ ~/wicopa [master|✔]
13:41 $ wget http://web.mbb.univ-montp2.fr/download/wicopa.sql.gz && gunzip -d wicopa.sql.gz
--2019-05-14 13:41:29-- http://web.mbb.univ-montp2.fr/download/wicopa.sql.gz
Résolution de web.mbb.univ-montp2.fr (web.mbb.univ-montp2.fr)… 162.38.181.47
Connexion à web.mbb.univ-montp2.fr (web.mbb.univ-montp2.fr)|162.38.181.47|:80… connecté.
requête HTTP transmise, en attente de la réponse… 200 OK
Taille : 37436098 (36M) [application/x-gzip]
Sauvegarde en : « wicopa.sql.gz »
wicopa.sql.gz 100%[======================================================================================================================>] 35,70M 80,1MB/s ds 0,4s
2019-05-14 13:41:29 (80,1 MB/s) — « wicopa.sql.gz » sauvegardé [37436098/37436098]
✔ ~/wicopa [master|✔]
13:41 $ podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
✔ ~/wicopa [master|✔]
13:41 $ python ../podman-compose/podman-compose.py build
podman build -t wicopa_web -f .docker/web/Dockerfile .docker/web
STEP 1: FROM alpine:3.9
STEP 2: LABEL Author remyd1 - https://github.com/remyd1
--> Using cache e125c1dc1d780509b47bf73f4d678faa8ed686de3e1055b6eb56886e3ad554a4
STEP 3: FROM e125c1dc1d780509b47bf73f4d678faa8ed686de3e1055b6eb56886e3ad554a4
STEP 4: RUN apk --update add php-apache2 php7-session php7-mysqli && rm -f /var/cache/apk/*
--> Using cache 80733cb0b5837b09a2f0ee99c1658ab6c353e38d3790568d2eded022ce8b633e
STEP 5: FROM 80733cb0b5837b09a2f0ee99c1658ab6c353e38d3790568d2eded022ce8b633e
STEP 6: RUN mkdir /app && cd /app && wget https://gitlab.mbb.univ-montp2.fr/jlopez/wicopa/-/archive/v0.4/wicopa-v0.4.tar.gz && tar -xf wicopa-v0.4.tar.gz && ln -s wicopa-v0.4 wicopa && cp wicopa/conf/Conf.php.sample wicopa/conf/Conf.php && chown -R apache:apache /app && sed -i "s#DB_NAME = ''#DB_NAME = 'wicopa'#" wicopa/conf/Conf.php && sed -i "s#DB_HOSTNAME = ''#DB_HOSTNAME = 'wicopadb'#" wicopa/conf/Conf.php && sed -i "s#DB_USERNAME = ''#DB_USERNAME = 'wicopauser'#" wicopa/conf/Conf.php && sed -i "s#DB_PP = ''#DB_PP = 'w1c0Pa5s'#" wicopa/conf/Conf.php && sed -i "s#'to_replace_with_your_admin_pass'#'450cb0c92db35549cb926efc391df2ceae4b48d1'#" wicopa/conf/Conf.php
--> Using cache 9bf171fc43ef9bb3d698d09be8157e568fdb7702f9841952c52137fc89b7c5b5
STEP 7: FROM 9bf171fc43ef9bb3d698d09be8157e568fdb7702f9841952c52137fc89b7c5b5
STEP 8: RUN sed -i 's/^#ServerName .*/ServerName localhost:80/g' /etc/apache2/httpd.conf && sed -i 's#/var/www/localhost/htdocs#/app/wicopa#g' /etc/apache2/httpd.conf && sed -i 's/^LoadModule php7_module.*/LoadModule php7_module modules\/libphp7\.so/g' /etc/apache2/httpd.conf && sed -i 's/DirectoryIndex index\.html/DirectoryIndex index\.php/g' /etc/apache2/httpd.conf && sed -ri 's#^DocumentRoot .*#DocumentRoot "/app/wicopa"#g' /etc/apache2/httpd.conf && sed -i 's#AllowOverride None#AllowOverride All#g' /etc/apache2/httpd.conf && echo "AddType application/x-httpd-php .php" >> /etc/apache2/httpd.conf
--> Using cache 6dd81e691505f5c40fc28aa6e3a84d86b15adc9574fe05bf727160f59e1de28f
STEP 9: FROM 6dd81e691505f5c40fc28aa6e3a84d86b15adc9574fe05bf727160f59e1de28f
STEP 10: RUN echo "Success"
--> Using cache 63f45c93dc519b6d1104699b53127278b527213545224133077f03dbd49c6cd2
STEP 11: FROM 63f45c93dc519b6d1104699b53127278b527213545224133077f03dbd49c6cd2
STEP 12: EXPOSE 80
--> Using cache a13778223a62f95344e7a4dff8d56126d81892c1c2e96455a69a1ca1685452ee
STEP 13: FROM a13778223a62f95344e7a4dff8d56126d81892c1c2e96455a69a1ca1685452ee
STEP 14: ENTRYPOINT httpd -D FOREGROUND && /bin/bash
--> Using cache 5eae286585bf3f40b5308be53930914024ff23acf23cd879a5ff058b546670e9
STEP 15: COMMIT wicopa_web
--> 5eae286585bf3f40b5308be53930914024ff23acf23cd879a5ff058b546670e9
0
✔ ~/wicopa [master|✔]
13:41 $ python ../podman-compose/podman-compose.py up
podman stop -t=1 wicopa_web_1
Error: no container with name or ID wicopa_web_1 found: no such container
125
podman stop -t=1 wicopa_db_1
Error: no container with name or ID wicopa_db_1 found: no such container
125
podman rm wicopa_web_1
1
podman rm wicopa_db_1
1
podman pod rm wicopa
Error: unable to lookup pod wicopa: no pod with name or ID wicopa found: no such pod
125
podman pod create --name=wicopa --share net -p 8000:80
7d3605a8a936054e016fa45366805445e71671c018ed2d6e5e3ae00eeaf8ba2c
0
podman run --name=wicopa_web_1 -d --pod=wicopa -l io.podman.compose.config-hash=123 -l io.podman.compose.project=wicopa -l io.podman.compose.version=0.0.1 -l com.docker.compose.container-number=1 -l com.docker.compose.service=web --add-host web:127.0.0.1 --add-host wicopa_web_1:127.0.0.1 --add-host db:127.0.0.1 --add-host wicopa_db_1:127.0.0.1 wicopa_web
e6ce0c4bd391a72e1208bab2cf5f1eae571576932039715d93b57bfa22ff74ea
0
podman run --name=wicopa_db_1 -d --pod=wicopa -l io.podman.compose.config-hash=123 -l io.podman.compose.project=wicopa -l io.podman.compose.version=0.0.1 -l com.docker.compose.container-number=1 -l com.docker.compose.service=db -e MYSQL_ROOT_PASSWORD=w1c0Pa5s -e MYSQL_PASSWORD=w1c0Pa5s -e MYSQL_USER=wicopauser -e MYSQL_DATABASE=wicopa -v /home/userwi/wicopa/.docker/db/wicopa:/var/lib/mysql:z -v /home/userwi/wicopa/wicopa.sql:/docker-entrypoint-initdb.d/wicopa.sql:z --add-host web:127.0.0.1 --add-host wicopa_web_1:127.0.0.1 --add-host db:127.0.0.1 --add-host wicopa_db_1:127.0.0.1 --expose 3306 mariadb:10.3
5935e5ea71e63b009765abbd2f2180af2aa738c4449c3e218eb40d0b9ab00bd6
0
✔ ~/wicopa [master|✔]
13:41 $ podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5935e5ea71e6 docker.io/library/mariadb:10.3 docker-entrypoint... 4 seconds ago Up 4 seconds ago 0.0.0.0:8000->80/tcp wicopa_db_1
e6ce0c4bd391 localhost/wicopa_web:latest /bin/sh -c httpd ... 6 seconds ago Up 5 seconds ago 0.0.0.0:8000->80/tcp wicopa_web_1
✔ ~/wicopa [master|✔]
13:42 $ sudo netstat -naptu |grep 3306
✘-1 ~/wicopa [master|✔]
As you can see, the expose 3306 for wicopa_db does not seem to work.
Would you like me to create a new issue ? As this seems not related to this one.
Best regards,
from podman-compose.
@remyd1 please confirm that solved your problem.
in the future you should use service names to communicate because, think of the service as a stable load-balancer that might back multiple containers. (for example if you deploy on swarm or kubernetes)
from podman-compose.
Indeed, it works ! Thank you very much @muayyad-alsadi for this quick update !
from podman-compose.
Related Issues (20)
- `network_mode: none` is ignored
- Error in podman-compose up command HOT 3
- Mismatch of Documentation and Implementation of UID/GID Mappings
- Replicate environment variable from local environment fails with default `.env` -file HOT 3
- Support changing `io.podman` label domain namespace
- Doc about systemd unit generation missing or unclear?
- Add --profile to bash completion
- podman-compose up is reporting that the folder is not empty
- 'podman-compose build' builds replicate images for each service in docker-compose.yaml that share a common image.
- 1.1.0 (and perhaps above) broke the use of Containerfiles HOT 1
- Error: unknown flag: --env HOT 1
- podman-compose should throw a readable error on too old python HOT 2
- All integration tests should be run automatically HOT 1
- Environment should not be set in build context HOT 2
- Detect case when port forwarding is used together with uid/gid mapping on Podman 3.4.x and issue warning HOT 4
- podman-compose up -d <container> starts other containers in the compose file
- lint checks in CI don't currently work properly.
- Release version 1.2.0 to EPEL 8 / EPEL 9 HOT 1
- Integration tests should not use network connectivity if not necessary
- Incorrect implementation of `include` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from podman-compose.