containers

How to know the reason why a docker container exits?

孤街醉人 提交于 2019-12-02 19:53:45
I have a Docker container running in a host of 1G RAM (there are also other containers running in the same host). The application in this Docker container will decode some images, which may consume memory a lot. From time to time, this container will exit. I doubt it is due to out of memory but not very sure. I need a method to find the root cause. So is there any way to know what happened for this container's death? Others have mentioned docker logs $container_id to view the output of the application. This would always be my first thing to check. Next, you can run a docker inspect $container

STL Container: Constructor's Allocator parameter and scoped allocators

社会主义新天地 提交于 2019-12-02 19:24:05
There is a template parameter for STL containers to chose a custom allocator. It took a while, but I think I understand how it works. Somehow it isn't really nice because the given allocator type isn't used directly but it is rebound to the allocator of another type. Finally I can work with it. After reading the API I recognized that there is also the possibility to give allocators as constructor parameter. But how do I know which kind of allocator the container uses, if it internally rebinds the given allocator from the template parameter? Additionally I read that C++11 now uses scoped

docker restart container failed: “already in use”, but there's no more docker image

感情迁移 提交于 2019-12-02 18:48:04
I first got my nginx docker image: docker pull nginx Then I started it: docker run -d -p 80:80 --name webserver nginx Then I stopped it: docker stop webserver Then I tried to restart it: $docker run -d -p 80:80 --name webserver nginx docker: Error response from daemon: Conflict. The container name "/webserver" is already in use by container 036a0bcd196c5b23431dcd9876cac62082063bf62a492145dd8a55141f4dfd74. You have to remove (or rename) that container to be able to reuse that name.. See 'docker run --help'. Well, it's an error. But in fact there's nothing in container list now: docker container

use template to print all the data of any container

蹲街弑〆低调 提交于 2019-12-02 18:12:35
问题 I plan to write a function which can print all the data of any container. In other words, I can use with different containers type like vector, deque or list and that I can call it with different data types ( integers , double or string). The template function can pass the compiler, but I do not know how to call it. #include <cstdlib> #include <stdio.h> #include <iostream> #include <list> using namespace std; template <typename C, template <typename C> class M> void print(M<C> data){ typename

How to inspect a container's IP, obtain it and add it to /etc/hosts file with a local domain name resolution

元气小坏坏 提交于 2019-12-02 18:07:38
问题 I am working on Linux Ubuntu with docker containers and I want the following added to the last line of /etc/hosts in a new line: IP_from_docker_container hostname_assigned 172.20.1.2 docker.dev.example.com I have been trying commands such as: echo, printf, aux, sed, tee This is what i unsuccessfully tried: echo "\n" | docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' CONTAINER | echo " docker.dev.whip-around.com" | sudo tee -a /etc/hosts Command to get container's

std::map<int, int> vs. vector of vector

怎甘沉沦 提交于 2019-12-02 17:54:32
问题 I need a container to store a value (int) according to two attributes, source (int) and destination (int) i.e. when a source sends something to a destination, I need to store it as an element in a container. The source is identified by a unique int ID (an integer from 0-M), where M is in the tens to hundreds, and so is the destination (0-N). The container will be updated by iterations of another function. I have been using a vector(vector(int)) which means goes in the order of source

How do I forward a docker-machine port to my host port on OSX?

核能气质少年 提交于 2019-12-02 17:37:59
I’m delivering a private docker container in my company and want my colleagues to be able to access in our internal network, the problem is that my guest OS is OSX and as so I can only access my application using the 192.168.99.100:3000 default ip from docker machine. How can I forward the docker-machine 3000 port to my host 80 port? At this time Docker Machine is a virtual machine running under VirtualBox in your machine, so to expose your application port you need to map your virtual machine port to your host port. To achieve this there are two options, but before make sure your Docker

Safe parallel read-only access to a STL container

瘦欲@ 提交于 2019-12-02 17:36:33
I want access a STL based container read-only from parallel running threads. Without using any user implemented locking. The base of the following code is C++11 with a proper implementation of the standard. http://gcc.gnu.org/onlinedocs/libstdc++/manual/using_concurrency.html http://www.sgi.com/tech/stl/thread_safety.html http://www.hpl.hp.com/personal/Hans_Boehm/c++mm/threadsintro.html http://www.open-std.org/jtc1/sc22/wg21/ ( current draft or N3337 , which is essentially C++11 with minor errors and typos corrected) 23.2.2 Container data races [container.requirements.dataraces] For purposes

Tomcat--Web Server or Web Container?

淺唱寂寞╮ 提交于 2019-12-02 17:34:22
I've a small doubt in my mind; could anyone please clarify me is the Tomcat web server or Web container? It's both a web server (supports HTTP protocol) and a web container (supports JSP/Servlet API, also called "servlet container" at times). As mentioned above, Tomcat is both a web server and a web container, but it's not really meant to function as a high performance web server, nor does it include some features typical of a web server. Tomcat is meant to be used in conjunction with the Apache web server, where Apache manages static pages, caching, redirection, etc. and Tomcat handles the

Why STL containers are preferred over MFC containers?

风流意气都作罢 提交于 2019-12-02 16:15:59
Previously, I used to use MFC collection classes such CArray and CMap . After a while I switched to STL containers and have been using them for a while. Although I find STL much better, I am unable to pin point the exact reasons for it. Some of the reasoning such as : It requires MFC: does not hold because other parts of my program uses MFC It is platform dependent: does not hold because I run my application only on windows.(No need for portability) It is defined in the C++ standard: OK, but MFC containers still work The only reason I could come up is that I can use algorithms on the