Posts

Showing posts with the label docker

Docker mongodb connection refused on mac os when loading http://0.0.0.0:27017

Docker mongodb connection refused on mac os when loading http://0.0.0.0:27017 Browser Screenshot I have 2 docker containers running mongo:3.0.3 and python:2.7. And I have an app.py which connects to mongodb instance. In my app.py I have used port 5000 to map 27017. The app.py runs fine but when I visit http://0.0.0.0:5000 this connection refused error comes on terminal. 172.17.0.1 - - [01/Jul/2018 10:01:32] "GET / HTTP/1.1" 500 - Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__ return self.wsgi_app(environ, start_response) File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app response = self.make_response(self.handle_exception(e)) File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1817, i...

UTF-8 encoding not working in Docker

UTF-8 encoding not working in Docker I'm running a Java program from within a Docker container (started with Docker Compose) and it's throwing a bunch of errors caused by UTF-8 characters (as they can't be mapped to the ASCII charset). Is there a way to enable UTF-8 encoding from the docker-compose file? Seems to me this has nothing to do with docker but all with your Java program. – Henry Jul 1 at 6:28 The program works outside of the Docker container...inside, it outputs "unmappable character for encoding ASCII" when trying to read a French character – Justin Borromeo Jul 1 at 6:43 @JustinBorromeo This proves that you've written your Java ...

Python shell log command not showing up in docker/kubernetes pod

Python shell log command not showing up in docker/kubernetes pod I ran the following code in the python shell but it is not showing up the docker/kubernetes pod logs: import logging logging.basicConfig(level=logging.INFO) logging.info("Test") This is a simplified version of what I am trying to do which is essentially run one-off scripts/commands in the python shell and have logs to show up. How do I go about getting this to work? Is it because the shell I opened up is not attached to the process that creates the logs? I'm currently using Docker and Kubernetes. Thanks! You ran this in a shell? If so then it wont be in the logs. The PID 1 stdout only is sent to logs – Tarun Lalwani Jul 1 at 9:29 What @TarunLalwani said is 100% true, but you can also cheat and tee the output into /proc/1/fd/1 to have...

Docker: “service” command works but “systemctl” command doesn't work

Docker: “service” command works but “systemctl” command doesn't work I pulled centos6 image and made a container from it. I got its bash by: $ docker run -i -t centos:centos6 /bin/bash On the centos6 container, I could use "service" command without any problem. But when I pulled&used centos7 image: $ docker run -i -t centos:centos7 /bin/bash Both of "service" and "systemctl" didn't work. The error message is: Failed to get D-Bus connection: Operation not permitted My question is: 1. How are people developing without "service" and "systemctl" commands? 2. If I want to use, for example, httpd.service on the centos7 container, what should I do? Or maybe running services on a container is not recommended? 3 Answers 3 There is no process supervisor running inside either container. The service command in your CentOS 6 container works by ...

docker daemon -H fd:// error out in shell

docker daemon -H fd:// error out in shell I start the docker daemon with -H fd:// in shell, and it error out. The OS is CentOS7. -H fd:// # docker daemon -H fd:// FATA[0000] No sockets found I can start with systemctl start docekr . systemctl start docekr # cat /etc/systemd/system/docker.service.d/docker.conf [Service] ExecStart= ExecStart=/usr/bin/docker daemon -H fd:// # ps -ef|grep docker /usr/bin/docker daemon -H fd:// In the admin guide, it says On Systemd based systems, you can communicate with the daemon via Systemd socket activation, use docker daemon -H fd://. Using fd:// will work perfectly for most setups but you can also specify individual sockets: docker daemon -H fd://3. If the specified socket activated files aren’t found, then Docker will exit. You can find examples of using Systemd socket activation with Docker and Systemd in the Docker source tree. So I can't use -H fd:// in shell? -H fd:// 2 Answers ...

How to tackle configuration file in Jenkins?

How to tackle configuration file in Jenkins? There are some configurations in my code (to connect DB). I wrote them in .env . Users need to create their own .env file to run the application. This is the copy code in Dockerfile: COPY .env server COPY .env test .env .env COPY .env server COPY .env test When I use Jenkins to build a pipline, I have to commit this file, but I should not do that(aws information included there). What is the best practice to save configuration file? Thanks Why not let jenkins handle the credentials for you? Are you talking about credentials for your pipeline or for the application you are deploying? – user3483203 Jun 30 at 19:30 @user3483203 thank you very much! I will check it out. – MongoliaOba Jul 1 at 3:17 ...

Add new command to CMD without overriding existing

Add new command to CMD without overriding existing I'm want to use existing docker image and add new command without overiding commands in cmd. Dockerfile FROM telegrammessenger/proxy COPY mtproto_stats . CMD [ "/bin/sh", "-c", "/bin/bash /run.sh", "/bin/bash ./mtproto_stats" ] Here i try to execute my programm which i copied to container CMD [ "/bin/sh", "-c", "/bin/bash /run.sh", "./mtproto_stats" ] This commands "/bin/sh", "-c", "/bin/bash /run.sh" i got using docker inspect on running container "/bin/sh", "-c", "/bin/bash /run.sh" docker inspect My programm should run with container and work all time, i'm trying use "./mtproto_stats & disown" but it not help "./mtproto_stats & disown" It's not clear what you are trying to achieve. – dpwrussell ...