I am running a dockerized ubuntu for a Meteor (js) application with docker-compose file on my personnal computer. It is attached to a mongo DB container. And a nginx proxy container is running to make my development url secured with ssl (https).
Since I stopped my containers with docker-compose down, when I restart them, my webapp container exits (with exit code 6) all the time. I didn't change the docker-compose files since my previous docker-compose -f docker-compose.dev.yml --verbose up
docker-compose -f docker-compose.dev.yml --verbose up
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- ('26d90365fe9a4b0c0eb24cb2c040aa43cf8ec207764f350b6273ee7362d9fe0e')
compose.cli.verbose_proxy.proxy_callable: docker wait <- ('26d90365fe9a4b0c0eb24cb2c040aa43cf8ec207764f350b6273ee7362d9fe0e')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/containers/26d90365fe9a4b0c0eb24cb2c040aa43cf8ec207764f350b6273ee7362d9fe0e/json HTTP/1.1" 200 None
urllib3.connectionpool._make_request: http://localhost:None "POST /v1.25/containers/26d90365fe9a4b0c0eb24cb2c040aa43cf8ec207764f350b6273ee7362d9fe0e/wait HTTP/1.1" 200 30
compose.cli.verbose_proxy.proxy_callable: docker wait -> {'Error': None, 'StatusCode': 6}
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {'AppArmorProfile': 'docker-default',
'Args': [],
'Config': {'ArgsEscaped': True,
'AttachStderr': False,
'AttachStdin': False,
'AttachStdout': False,
'Cmd': ['meteor'],
'Domainname': '',
'Entrypoint': None,
'Env': ['ENV_APP_SERVER_USERNAME=app',
...webappContainer exited with code 6
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
26d90365fe9a xxxxxxxxxx_webapp "meteor" 23 minutes ago Exited (6) 13 seconds ago webappContainer
4073bbfe37cf mongo "docker-entrypoint.s…" 39 minutes ago Up 14 seconds 0.0.0.0:27017->27017/tcp mongoDBContainer
201f0a99d1cf jwilder/nginx-proxy:alpine "/app/docker-entrypo…" 2 hours ago Up 2 hours 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp nginx-proxy_nginx-proxy_1
docker logs <container_id>
** none **
How ? The container will not even start. When I do docker run it works..
version: '3'
services:
webapp:
container_name: webappContainer
env_file: .env
environment:
VIRTUAL_HOST: mysite.local
VIRTUAL_PORT: ${PORT}
build:
context: ${CONTEXT}
dockerfile: ${DOCKERFILE}...
volumes:
- ${VOLUME}:/usr/src/app
expose:
- ${PORT}
networks:
- dbAppConnector
- default
depends_on:
- mongodb
mongodb:...
container_name: ${MONGO_CONTAINER_NAME}
image: mongo
restartmongodb: always
env_file: .env
ports:
- "${MONGO_PORT}:${MONGO_PORT}"..
networks:
dbAppConnector:
volumes:
- mongo_volume:/data/db
- ./docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
volumes:
mongo_volume:
networks:
default:
external:
name: nginx-proxy
dbAppConnector:
Note that when i do
docker-compose config
every .env variables are correctly displayed.
FROM ubuntu:18.04
# Set environment dir & copy files
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . /usr/src/app
# Make host.docker.internal accessible from outside the container (dev only)
# RUN ip -4 route list match 0/0 | awk '{print $3 "host.docker.internal"}' >> /etc/hosts
# Add user to run localy (dev only) the app
RUN addgroup meteoruser && useradd -rm -d /home/moff -s /bin/bash -g root -G sudo -u 1000 meteoruser
# Update distribution
RUN apt-get update -q && apt-get clean \
# Install curl
&& apt-get install curl -y \
# Install Meteor
&& (curl https://install.meteor.com | sh) \
# Install node js
&& cd /usr/src/app \
# replace vx.x.x by meteor node -e 'console.log("I am Node.js %s!", process.version);' output from my project folder.
&& bash -c 'curl "https://nodejs.org/dist/v8.15.1/node-v8.15.1-linux-x64.tar.gz" > /usr/src/app/required-node-linux-x64.tar.gz' \
&& cd /usr/local && tar --strip-components 1 -xzf /usr/src/app/required-node-linux-x64.tar.gz \
&& rm /usr/src/app/required-node-linux-x64.tar.gz \
&& cd /usr/src/app \
&& npm install
RUN cd /usr/src/app && chown -Rh meteoruser .meteor/local
EXPOSE 80
ENV PORT 80
WORKDIR /usr/src/app
USER meteoruser
CMD ["meteor"]
?release=1.8.0.2
in the Dockerfile.dev part where I do && (curl https://install.meteor.com | sh) \
.docker run xxxxxxx_webapp
.This is your first time using Meteor!
Installing a Meteor distribution in your home directory.
Downloading Meteor distribution
It took 2+ minutes to finally show :
Retrying download in 5 seconds …
Retrying download in 5 seconds …
Retrying download in 5 seconds …
Retrying download in 5 seconds …
[[[[[ /usr/src/app ]]]]]
=> Started proxy.
=> Started MongoDB.
And so the container is running without exiting with the separate docker run
command..
Reminder: everything was working fine for 4+ weeks, then suddenly I suspect my new internet connection being too slow (I moved from my parents house 1 week ago).
Could you guys please give some advises ? Is there any additional information I could provide to help you understand what I am missing ? Thanks in advance!
Other tries to make things work:
答案 0 :(得分:1)
尽管我也从来没有发现退出代码6是什么,但我确实在我的设置中找到了原因。 事实证明我的环境是无效的,因为我不小心将其设置为一个不存在的分支。
docker-compose --verbose设置我正确的路径
答案 1 :(得分:0)
我是这样从计算机上的docker卸载e-v-e-r-y-t-h-i-n-g的:
警告:请注意,通过此过程,您将丢失配置,图像和容器。
sudo docker system prune
sudo docker volume prune
sudo docker network prune
apt-get remove --purge docker*
rm -rf /var/lib/docker
rm -rf /etc/docker
rm /etc/systemd/system/docker.service
rm /etc/init/d/docker
apt-get autoremove && apt-get autoclean
apt-get update && apt-get upgrade
最后从以下位置重新安装了docker和docker-compose:
然后在,我从git重新下载了我的项目,并使用docker-compose up -d
重新安装了它:)
所以,我相信这是docker的配置问题。不幸的是,我从未对“退出代码6”找到明确的答案。
如果遇到同样的“退出代码6”问题,请随时分享您的解决方案。