containers

Passing the $HOSTNAME to a Docker container at build

限于喜欢 提交于 2019-12-10 22:53:25
问题 I've seen a couple posts about this but they do not answer the question of "How does one pass the a host's hostname at build time to a container?" The reason I need to pass the hostname at build time (in the docker file) instead of at creation time is because I am using docker swarm and if I pass the hostname when I create the service like so I will only get one hostname for every container: $ docker service create -p <port>:<port> --hostname $HOSTNAME --replicas 4 <image> By passing the

How to connect localhost:3306 of mysql container via app container- docker

旧时模样 提交于 2019-12-10 22:45:01
问题 In my application setting I am connecting to db with below settings spring.jpa.hibernate.ddl-auto=none spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/gosallowMultiQueries=true&createDatabaseIfNotExist=true spring.datasource.username=root spring.datasource.password=root Now I have two container App and mysql. I have linked both container docker run --name app --link mysql:dbalias appimage but I am getting Communications link failure

Kubernetes Autoscaling Containers

爱⌒轻易说出口 提交于 2019-12-10 22:32:39
问题 is it possible to autoscale docker containers, which contain application servers (like wildfly/tomcat/jetty/) within kubernetes ? For example at cpu & ram use or based on http requests ? If there is a build in feature for that i can't find it, or is it possible to write something like a configuration script for this ? If so where does the magic happen ? 回答1: Autoscaling of containers is not yet supported and is not part of the near term 1.0 roadmap for Kubernetes (meaning that the core team

QList, QVector or std::vector multi-threaded usage

那年仲夏 提交于 2019-12-10 22:12:22
问题 I would like two threads work like this: First thread will append values to vector Second thread will have read-only access to elements by index I can make mutex and make deep copy before second thread start reading.... But this way is really slow... How is it possible to make this without mutex? Here: STL vector and thread-safety I read that it is possible to use std::deque, but it fails like std::vector ... Where I can find append-only container, which don't realloc data? I have solved my

C++: use own class in a multiset container

早过忘川 提交于 2019-12-10 21:07:57
问题 at first I'm new here and English isn't my native language so apologize for any grammatical failures but I find this community really nice so I will try to ask my question as precise as I can. I want to add my own class object into a stl container multiset and want to sort it with my own overloaded less operator defined in my class. I really tried out several solutions but nothing really worked so I hope someone can give me some useful hints to solve it. Here is my general idea of my class

Unable to access Symfony2 container in controller extending Symfony\Bundle\FrameworkBundle\Controller\Controller

喜夏-厌秋 提交于 2019-12-10 19:58:19
问题 Original Question I've read every page of the "book" about service containers, and I'm still baffled because things seem to randomly not work nearly every time I try to use $this->container . For example, I'm building a form in my custom bundle controller following the instructions. My controller extends the base controller as usual: namespace Gutensite\ArticleBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use

Container doesn't resize itself after invoking validate

偶尔善良 提交于 2019-12-10 19:49:42
问题 After manually swapping components via add and remove , I invoke validate() on the container. According to the documentation, The validate method is used to cause a container to lay out its subcomponents again . It should be invoked when this container's subcomponents are modified (added to or removed from the container, or layout-related information changed) after the container has been displayed. The phrase " lay out its subcomponents again " makes me think that the container will resize

Create SQL Server database from a script in docker

妖精的绣舞 提交于 2019-12-10 19:44:06
问题 Simple question I hope. I cannot find anything anywhere. How do you create a database in a Microsoft SQL Server Docker container? Dockerfile : I am looking at the following Dockerfile : FROM microsoft/mssql-server-windows-developer:latest ENV sa_password ab873jouehxaAGR WORKDIR / COPY /db-scripts/create-db.sql . # here be the existing run commnd in the image microsoft/mssql-server-windows-developer:latest #CMD ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference =

Mounting a gcePersistentDisk kubernetes volume is very slow

此生再无相见时 提交于 2019-12-10 19:24:22
问题 I start a kubernetes replication controller. When the corresponding container in the single pod in this replication controller has a gcePersistentDisk specified the pods will start very slow. After 5 minutes the pod is still in the Pending state. kubectl get po will tell me: NAME READY STATUS RESTARTS AGE app-1-a4ni7 0/1 Pending 0 5m Without the gcePersistentDisk the pod is Running in max 30 seconds. (I am using a 10 GB Google Cloud Storage disk and I know that these disks have lower

Define an iterator type in a stl container wrapper

倖福魔咒の 提交于 2019-12-10 18:27:59
问题 What it the right way to write a wrapper class around an STL container, which is also a template (can accept a generic type T as element) and allows me to use an iterator as I would do with the STL container directly? I want to do something of the following type #include <list> #include <iostream> class MyClass{}; template<class T> class Wrapper { public: typename std::list<T>::iterator iterator; std::list<T> elements; iterator begin(){ return elements.begin(); }; iterator end(){ return