Different stdout with supervisord using docker vs docker-composeNginx: How to use docker log collector when nginx is running under supervisord404 when serving static files with docker+nginx+django/angularjsImmutable Server model with Docker/Ansible vs. Ansible, Puppet, and Foreman in AWS?How can I automatically restart my Docker containers with container auto-delete?
Why is Bézout's identity considered an identity?
Intuitively, why does putting capacitors in series decrease the equivalent capacitance?
Do 3D printers really reach 50 micron (0.050mm) accuracy?
Procedurally generate regions on island
Going to get married soon, should I do it on Dec 31 or Jan 1?
MH370 blackbox - is it still possible to retrieve data from it?
One folder two different locations on ubuntu 18.04
Generate and graph the Recamán Sequence
If a high rpm motor is run at lower rpm, will it produce more torque?
Why is Madam Hooch not a professor?
Why isn’t the tax system continuous rather than bracketed?
Does ultrasonic bath cleaning damage laboratory volumetric glassware calibration?
Are there any vegetarian astronauts?
Difference between 'demás' and 'otros'?
I played my first (rapid) tournament recently and I wanted to calculate my ELO
Find smallest index that is identical to the value in an array
Why is the Turkish president's surname spelt in Russian as Эрдоган, with г?
How to write or read powers (math) by words?
In native German words, is Q always followed by U, as in English?
How exactly is a normal force exerted, at the molecular level?
When is it ok to add filler to a story?
Bash echo $-1 prints hb1. Why?
Confusion about multiple information Sets
Could Sauron have read Tom Bombadil's mind if Tom had held the Palantir?
Different stdout with supervisord using docker vs docker-compose
Nginx: How to use docker log collector when nginx is running under supervisord404 when serving static files with docker+nginx+django/angularjsImmutable Server model with Docker/Ansible vs. Ansible, Puppet, and Foreman in AWS?How can I automatically restart my Docker containers with container auto-delete?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a service running inside docker using nginx and php-fpm. I have been beating my head against the wall to get all of the logs to redirect to stdout. The approach that I took was to use supervisord. Using docker-compose up my-app
everything worked as expected; all of the logs are being sent to stdout. However, when I run
docker run -p 81:80
-v $(pwd)/myapp:/var/www/html
my-app
I get no output.
Here is my supervisor configuration:
[supervisord]
nodaemon=true
user=root
[program:php-fpm]
command=/usr/sbin/php-fpm7.0 -F
[program:nginx]
command=/usr/sbin/nginx -g "daemon off;"
[program:nginx-log-access]
command=/usr/bin/tail -f /var/log/nginx/access.log
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
autorestart=true
[program:nginx-log-error]
command=/usr/bin/tail -f /var/log/nginx/error.log
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
autorestart=true
[program:php-fpm-log]
command=/usr/bin/tail -f /var/log/php7.0-fpm.log
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
autorestart=true
startsecs=3
[program:laravel-log]
command=/usr/bin/tail -f /var/www/html/storage/logs/laravel.log
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
autorestart=true
and my docker-compose
version: '3'
services:
my-app:
build:
context: ../../my-app
dockerfile: docker/Dockerfile
image: my-app
ports:
- "81:80"
volumes:
- ../../my-app:/var/www/html
my base dockerfile
FROM ubuntu
# Update
RUN apt-get update --fix-missing && apt-get -y upgrade
# Install Python Setup Tools
RUN apt-get install -y python-pip
# Intall Supervisord
RUN easy_install supervisor
# Install NGINX
RUN apt-get -y install nginx
# Install PHP
RUN apt-get -y install php7.0-fpm
php7.0-mbstring
php7.0-xml
php7.0-curl
# Configure PHP-FPM
RUN sed -i 's/;daemonize = .*/daemonize = no/' /etc/php/7.0/fpm/php-fpm.conf &&
sed -i "/;clear_env = .*/cclear_env = no" /etc/php/7.0/fpm/pool.d/www.conf &&
sed -i -e 's/max_execution_time = 30/max_execution_time = 300/g' /etc/php/7.0/fpm/php.ini &&
sed -i -e 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /etc/php/7.0/fpm/php.ini &&
sed -i -e 's/post_max_size = 8M/post_max_size = 50M/g' /etc/php/7.0/fpm/php.ini &&
sed -i -e "s/variables_order = "GPCS"/variables_order = "EGPCS"/g" /etc/php/7.0/fpm/php.ini &&
service php7.0-fpm start &&
service php7.0-fpm stop
COPY supervisor.conf /etc/supervisor/conf.d/supervisor.conf
CMD ["supervisord", "-n", "-c", "/etc/supervisor/conf.d/supervisor.conf"]
and my application dockerfile
FROM mybase
# Configure NGINX
COPY docker/dev2/default.conf /etc/nginx/sites-enabled/default
# Copy application into container
COPY . /var/www/html
RUN touch /var/www/html/storage/logs/laravel.log &&
chown www-data:www-data /var/www/html/storage/logs/laravel.log &&
chmod 644 /var/www/html/storage/logs/laravel.log
COPY docker/dev2/supervisor.conf /etc/supervisor/conf.d/supervisor.conf
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisor.conf"]
What is the difference between docker
and docker-compose
where redirection to stdout is behaving differently? These containers will be deployed in AWS ECS; I haven't tested this yet, but I am fearful that I will not get successful logging in ECS if I am experiencing this behavior with docker
. Any thoughts, ideas, or suggestions would be greatly appreciated!
logging docker supervisord amazon-ecs
add a comment |
I have a service running inside docker using nginx and php-fpm. I have been beating my head against the wall to get all of the logs to redirect to stdout. The approach that I took was to use supervisord. Using docker-compose up my-app
everything worked as expected; all of the logs are being sent to stdout. However, when I run
docker run -p 81:80
-v $(pwd)/myapp:/var/www/html
my-app
I get no output.
Here is my supervisor configuration:
[supervisord]
nodaemon=true
user=root
[program:php-fpm]
command=/usr/sbin/php-fpm7.0 -F
[program:nginx]
command=/usr/sbin/nginx -g "daemon off;"
[program:nginx-log-access]
command=/usr/bin/tail -f /var/log/nginx/access.log
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
autorestart=true
[program:nginx-log-error]
command=/usr/bin/tail -f /var/log/nginx/error.log
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
autorestart=true
[program:php-fpm-log]
command=/usr/bin/tail -f /var/log/php7.0-fpm.log
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
autorestart=true
startsecs=3
[program:laravel-log]
command=/usr/bin/tail -f /var/www/html/storage/logs/laravel.log
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
autorestart=true
and my docker-compose
version: '3'
services:
my-app:
build:
context: ../../my-app
dockerfile: docker/Dockerfile
image: my-app
ports:
- "81:80"
volumes:
- ../../my-app:/var/www/html
my base dockerfile
FROM ubuntu
# Update
RUN apt-get update --fix-missing && apt-get -y upgrade
# Install Python Setup Tools
RUN apt-get install -y python-pip
# Intall Supervisord
RUN easy_install supervisor
# Install NGINX
RUN apt-get -y install nginx
# Install PHP
RUN apt-get -y install php7.0-fpm
php7.0-mbstring
php7.0-xml
php7.0-curl
# Configure PHP-FPM
RUN sed -i 's/;daemonize = .*/daemonize = no/' /etc/php/7.0/fpm/php-fpm.conf &&
sed -i "/;clear_env = .*/cclear_env = no" /etc/php/7.0/fpm/pool.d/www.conf &&
sed -i -e 's/max_execution_time = 30/max_execution_time = 300/g' /etc/php/7.0/fpm/php.ini &&
sed -i -e 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /etc/php/7.0/fpm/php.ini &&
sed -i -e 's/post_max_size = 8M/post_max_size = 50M/g' /etc/php/7.0/fpm/php.ini &&
sed -i -e "s/variables_order = "GPCS"/variables_order = "EGPCS"/g" /etc/php/7.0/fpm/php.ini &&
service php7.0-fpm start &&
service php7.0-fpm stop
COPY supervisor.conf /etc/supervisor/conf.d/supervisor.conf
CMD ["supervisord", "-n", "-c", "/etc/supervisor/conf.d/supervisor.conf"]
and my application dockerfile
FROM mybase
# Configure NGINX
COPY docker/dev2/default.conf /etc/nginx/sites-enabled/default
# Copy application into container
COPY . /var/www/html
RUN touch /var/www/html/storage/logs/laravel.log &&
chown www-data:www-data /var/www/html/storage/logs/laravel.log &&
chmod 644 /var/www/html/storage/logs/laravel.log
COPY docker/dev2/supervisor.conf /etc/supervisor/conf.d/supervisor.conf
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisor.conf"]
What is the difference between docker
and docker-compose
where redirection to stdout is behaving differently? These containers will be deployed in AWS ECS; I haven't tested this yet, but I am fearful that I will not get successful logging in ECS if I am experiencing this behavior with docker
. Any thoughts, ideas, or suggestions would be greatly appreciated!
logging docker supervisord amazon-ecs
add a comment |
I have a service running inside docker using nginx and php-fpm. I have been beating my head against the wall to get all of the logs to redirect to stdout. The approach that I took was to use supervisord. Using docker-compose up my-app
everything worked as expected; all of the logs are being sent to stdout. However, when I run
docker run -p 81:80
-v $(pwd)/myapp:/var/www/html
my-app
I get no output.
Here is my supervisor configuration:
[supervisord]
nodaemon=true
user=root
[program:php-fpm]
command=/usr/sbin/php-fpm7.0 -F
[program:nginx]
command=/usr/sbin/nginx -g "daemon off;"
[program:nginx-log-access]
command=/usr/bin/tail -f /var/log/nginx/access.log
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
autorestart=true
[program:nginx-log-error]
command=/usr/bin/tail -f /var/log/nginx/error.log
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
autorestart=true
[program:php-fpm-log]
command=/usr/bin/tail -f /var/log/php7.0-fpm.log
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
autorestart=true
startsecs=3
[program:laravel-log]
command=/usr/bin/tail -f /var/www/html/storage/logs/laravel.log
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
autorestart=true
and my docker-compose
version: '3'
services:
my-app:
build:
context: ../../my-app
dockerfile: docker/Dockerfile
image: my-app
ports:
- "81:80"
volumes:
- ../../my-app:/var/www/html
my base dockerfile
FROM ubuntu
# Update
RUN apt-get update --fix-missing && apt-get -y upgrade
# Install Python Setup Tools
RUN apt-get install -y python-pip
# Intall Supervisord
RUN easy_install supervisor
# Install NGINX
RUN apt-get -y install nginx
# Install PHP
RUN apt-get -y install php7.0-fpm
php7.0-mbstring
php7.0-xml
php7.0-curl
# Configure PHP-FPM
RUN sed -i 's/;daemonize = .*/daemonize = no/' /etc/php/7.0/fpm/php-fpm.conf &&
sed -i "/;clear_env = .*/cclear_env = no" /etc/php/7.0/fpm/pool.d/www.conf &&
sed -i -e 's/max_execution_time = 30/max_execution_time = 300/g' /etc/php/7.0/fpm/php.ini &&
sed -i -e 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /etc/php/7.0/fpm/php.ini &&
sed -i -e 's/post_max_size = 8M/post_max_size = 50M/g' /etc/php/7.0/fpm/php.ini &&
sed -i -e "s/variables_order = "GPCS"/variables_order = "EGPCS"/g" /etc/php/7.0/fpm/php.ini &&
service php7.0-fpm start &&
service php7.0-fpm stop
COPY supervisor.conf /etc/supervisor/conf.d/supervisor.conf
CMD ["supervisord", "-n", "-c", "/etc/supervisor/conf.d/supervisor.conf"]
and my application dockerfile
FROM mybase
# Configure NGINX
COPY docker/dev2/default.conf /etc/nginx/sites-enabled/default
# Copy application into container
COPY . /var/www/html
RUN touch /var/www/html/storage/logs/laravel.log &&
chown www-data:www-data /var/www/html/storage/logs/laravel.log &&
chmod 644 /var/www/html/storage/logs/laravel.log
COPY docker/dev2/supervisor.conf /etc/supervisor/conf.d/supervisor.conf
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisor.conf"]
What is the difference between docker
and docker-compose
where redirection to stdout is behaving differently? These containers will be deployed in AWS ECS; I haven't tested this yet, but I am fearful that I will not get successful logging in ECS if I am experiencing this behavior with docker
. Any thoughts, ideas, or suggestions would be greatly appreciated!
logging docker supervisord amazon-ecs
I have a service running inside docker using nginx and php-fpm. I have been beating my head against the wall to get all of the logs to redirect to stdout. The approach that I took was to use supervisord. Using docker-compose up my-app
everything worked as expected; all of the logs are being sent to stdout. However, when I run
docker run -p 81:80
-v $(pwd)/myapp:/var/www/html
my-app
I get no output.
Here is my supervisor configuration:
[supervisord]
nodaemon=true
user=root
[program:php-fpm]
command=/usr/sbin/php-fpm7.0 -F
[program:nginx]
command=/usr/sbin/nginx -g "daemon off;"
[program:nginx-log-access]
command=/usr/bin/tail -f /var/log/nginx/access.log
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
autorestart=true
[program:nginx-log-error]
command=/usr/bin/tail -f /var/log/nginx/error.log
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
autorestart=true
[program:php-fpm-log]
command=/usr/bin/tail -f /var/log/php7.0-fpm.log
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
autorestart=true
startsecs=3
[program:laravel-log]
command=/usr/bin/tail -f /var/www/html/storage/logs/laravel.log
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
autorestart=true
and my docker-compose
version: '3'
services:
my-app:
build:
context: ../../my-app
dockerfile: docker/Dockerfile
image: my-app
ports:
- "81:80"
volumes:
- ../../my-app:/var/www/html
my base dockerfile
FROM ubuntu
# Update
RUN apt-get update --fix-missing && apt-get -y upgrade
# Install Python Setup Tools
RUN apt-get install -y python-pip
# Intall Supervisord
RUN easy_install supervisor
# Install NGINX
RUN apt-get -y install nginx
# Install PHP
RUN apt-get -y install php7.0-fpm
php7.0-mbstring
php7.0-xml
php7.0-curl
# Configure PHP-FPM
RUN sed -i 's/;daemonize = .*/daemonize = no/' /etc/php/7.0/fpm/php-fpm.conf &&
sed -i "/;clear_env = .*/cclear_env = no" /etc/php/7.0/fpm/pool.d/www.conf &&
sed -i -e 's/max_execution_time = 30/max_execution_time = 300/g' /etc/php/7.0/fpm/php.ini &&
sed -i -e 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /etc/php/7.0/fpm/php.ini &&
sed -i -e 's/post_max_size = 8M/post_max_size = 50M/g' /etc/php/7.0/fpm/php.ini &&
sed -i -e "s/variables_order = "GPCS"/variables_order = "EGPCS"/g" /etc/php/7.0/fpm/php.ini &&
service php7.0-fpm start &&
service php7.0-fpm stop
COPY supervisor.conf /etc/supervisor/conf.d/supervisor.conf
CMD ["supervisord", "-n", "-c", "/etc/supervisor/conf.d/supervisor.conf"]
and my application dockerfile
FROM mybase
# Configure NGINX
COPY docker/dev2/default.conf /etc/nginx/sites-enabled/default
# Copy application into container
COPY . /var/www/html
RUN touch /var/www/html/storage/logs/laravel.log &&
chown www-data:www-data /var/www/html/storage/logs/laravel.log &&
chmod 644 /var/www/html/storage/logs/laravel.log
COPY docker/dev2/supervisor.conf /etc/supervisor/conf.d/supervisor.conf
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisor.conf"]
What is the difference between docker
and docker-compose
where redirection to stdout is behaving differently? These containers will be deployed in AWS ECS; I haven't tested this yet, but I am fearful that I will not get successful logging in ECS if I am experiencing this behavior with docker
. Any thoughts, ideas, or suggestions would be greatly appreciated!
logging docker supervisord amazon-ecs
logging docker supervisord amazon-ecs
asked Jun 14 '17 at 5:26
abergaberg
13 bronze badges
13 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
When you run docker-compose up
output from all docker containers is aggregated and displayed in the console as per
https://docs.docker.com/compose/reference/up/
When you simply run docker run
the output is not shown and can only be retrieved with docker logs -f $CONTAINERID
You can also "hide" output with docker compose by using -d
flag.
When you run your docker containers in ECS, in the task definition, you can choose the logdriver from the list
http://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_LogConfiguration.html
Hope this helps.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f855652%2fdifferent-stdout-with-supervisord-using-docker-vs-docker-compose%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
When you run docker-compose up
output from all docker containers is aggregated and displayed in the console as per
https://docs.docker.com/compose/reference/up/
When you simply run docker run
the output is not shown and can only be retrieved with docker logs -f $CONTAINERID
You can also "hide" output with docker compose by using -d
flag.
When you run your docker containers in ECS, in the task definition, you can choose the logdriver from the list
http://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_LogConfiguration.html
Hope this helps.
add a comment |
When you run docker-compose up
output from all docker containers is aggregated and displayed in the console as per
https://docs.docker.com/compose/reference/up/
When you simply run docker run
the output is not shown and can only be retrieved with docker logs -f $CONTAINERID
You can also "hide" output with docker compose by using -d
flag.
When you run your docker containers in ECS, in the task definition, you can choose the logdriver from the list
http://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_LogConfiguration.html
Hope this helps.
add a comment |
When you run docker-compose up
output from all docker containers is aggregated and displayed in the console as per
https://docs.docker.com/compose/reference/up/
When you simply run docker run
the output is not shown and can only be retrieved with docker logs -f $CONTAINERID
You can also "hide" output with docker compose by using -d
flag.
When you run your docker containers in ECS, in the task definition, you can choose the logdriver from the list
http://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_LogConfiguration.html
Hope this helps.
When you run docker-compose up
output from all docker containers is aggregated and displayed in the console as per
https://docs.docker.com/compose/reference/up/
When you simply run docker run
the output is not shown and can only be retrieved with docker logs -f $CONTAINERID
You can also "hide" output with docker compose by using -d
flag.
When you run your docker containers in ECS, in the task definition, you can choose the logdriver from the list
http://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_LogConfiguration.html
Hope this helps.
answered Jun 23 '17 at 14:20
AndreyAndrey
5182 silver badges8 bronze badges
5182 silver badges8 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f855652%2fdifferent-stdout-with-supervisord-using-docker-vs-docker-compose%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown