Questions tagged [containers]
A container is a class, a data structure, or an abstract data type whose instances are collections of other objects. Containers typically make use of generics or templates so that a wide variety of objects can be added.
containers
11,425
questions
531
votes
31
answers
720k
views
How to run a cron job inside a docker container?
I am trying to run a cronjob inside a docker container that invokes a shell script.
How can I do this?
530
votes
11
answers
304k
views
What's the difference between ClusterIP, NodePort and LoadBalancer service types in Kubernetes?
Question 1 - I'm reading the documentation and I'm slightly confused with the wording. It says:
ClusterIP: Exposes the service on a cluster-internal IP. Choosing this value makes the service only ...
292
votes
16
answers
529k
views
How can I keep a container running on Kubernetes?
I'm now trying to run a simple container with shell (/bin/bash) on a Kubernetes cluster.
I thought that there was a way to keep a container running on a Docker container by using pseudo-tty and ...
292
votes
4
answers
259k
views
List only stopped Docker containers
Docker gives you a way of listing running containers or all containers including stopped ones.
This can be done by:
$ docker ps # To list running containers
Or by
$ docker ps -a # To list running ...
282
votes
27
answers
87k
views
Why use iterators instead of array indices?
Take the following two lines of code:
for (int i = 0; i < some_vector.size(); i++)
{
//do stuff
}
And this:
for (some_iterator = some_vector.begin(); some_iterator != some_vector.end();
...
273
votes
12
answers
280k
views
Docker error cannot delete docker container, conflict: unable to remove repository reference
I want to remove the container at Docker, but an error occurs when you want to delete
My next step before removing the container, see the list of existing container
sts@Yudi:~/docker$ sudo docker ps ...
253
votes
4
answers
293k
views
Starting a shell in the Docker Alpine container
To start an interactive shell for the Ubuntu image we can run:
ole@T:~$ docker run -it --rm ubuntu
root@1a6721e1fb64:/# ls
bin boot dev etc home lib lib64 media mnt opt proc root run ...
188
votes
5
answers
205k
views
How to define build-args in docker-compose?
I have the following docker-compose file
version: '3'
services:
node1:
build: node1
image: node1
container_name: node1
node2:
build: node2
...
186
votes
13
answers
124k
views
How to get the list of dependent child images in Docker?
I'm trying to remove an image and I get:
# docker rmi f50f9524513f
Failed to remove image (f50f9524513f): Error response from daemon: conflict: unable to delete f50f9524513f (cannot be forced) - ...
183
votes
3
answers
151k
views
What are the complexity guarantees of the standard containers?
Apparently ;-) the standard containers provide some form of guarantees.
What type of guarantees and what exactly are the differences between the different types of container?
Working from the SGI page ...
170
votes
18
answers
165k
views
What is the best practice of docker + ufw under Ubuntu
I just tried out Docker. It is awesome but seems not work nicely with ufw. By default, docker will manipulate the iptables a little bit. The outcome is not a bug but not what I expected.
For more ...
167
votes
5
answers
151k
views
How to know the reason why a docker container exits?
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 ...
166
votes
11
answers
115k
views
How do I ssh into the VM for Minikube?
What is the username/password/keys to ssh into the Minikube VM?
166
votes
6
answers
88k
views
Why isn't vector<bool> a STL container?
Item 18 of Scott Meyers's book Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library says to avoid vector <bool> as it's not an STL container and it doesn't really ...
163
votes
12
answers
156k
views
What's the best way to iterate over two or more containers simultaneously
C++11 provides multiple ways to iterate over containers. For example:
Range-based loop
for(auto c : container) fun(c)
std::for_each
for_each(container.begin(),container.end(),fun)
However what is ...
162
votes
7
answers
171k
views
lsb_release: command not found in latest Ubuntu Docker container
I just wanted to test something out real quick. So I ran a docker container and I wanted to check which version I was running:
$ docker run -it ubuntu
root@471bdb08b11a:/# lsb_release -a
bash: ...
158
votes
13
answers
136k
views
How to check if a process is running inside docker container?
[Updated1] I have a shell which will change TCP kernel parameters in some functions, but now I need to make this shell run in Docker container, that means, the shell need to know it is running inside ...
157
votes
8
answers
244k
views
How to move Docker containers between different hosts?
I cannot find a way of moving docker running containers from one host to another.
Is there any way I can push my containers to repositories like we do for images ?
Currently, I am not using data ...
154
votes
16
answers
141k
views
Stop and delete Docker container if it's running
I am looking to pragmatically stop and delete a Docker container if it is running. This is for a build script.
Take the following example. How would I stop and delete the Docker container "...
153
votes
5
answers
222k
views
How to increase the size of the /dev/shm in docker container
Currently When I create new docker container the size of the shared memory directory is limited to 64MB. But, I need to increase this size since my application depend on this shared memory.
Is there ...
150
votes
4
answers
128k
views
Difference between Docker ENTRYPOINT and Kubernetes container spec COMMAND?
Dockerfile has a parameter for ENTRYPOINT and while writing Kubernetes deployment YAML file, there is a parameter in Container spec for COMMAND.
I am not able to figure out what's the difference and ...
147
votes
9
answers
136k
views
heapq with custom compare predicate
I am trying to build a heap with a custom sort predicate. Since the values going into it are of "user-defined" type, I cannot modify their built-in comparison predicate.
Is there a way to do ...
142
votes
19
answers
297k
views
How do I stretch an image to fit the whole background (100% height x 100% width) in Flutter?
I have an image that doesn't match the aspect ratio of my device's screen. I want to stretch the image so that it fully fills the screen, and I don't want to crop any part of the image.
CSS has the ...
140
votes
9
answers
240k
views
Connect to docker container as user other than root
BY default when you run
docker run -it [myimage]
OR
docker attach [mycontainer]
you connect to the terminal as root user, but I would like to connect as a different user. Is this possible?
129
votes
9
answers
313k
views
How to get IP address of running docker container
I am using Docker for Mac. I am running a nodejs based microservice in a Docker container. I want to test node microservice through the browser. How to get IP address of running docker container?
116
votes
11
answers
77k
views
Docker filling up storage on macOS
(Post created on Oct 05 '16)
I noticed that every time I run an image and delete it, my system doesn't return to the original amount of available space.
The lifecycle I'm applying to my containers is:
...
115
votes
7
answers
162k
views
How to SSH into Docker?
I'd like to create the following infrastructure flow:
How can that be achieved using Docker?
115
votes
2
answers
18k
views
Why does std::stack use std::deque by default?
Since the only operations required for a container to be used in a stack are:
back()
push_back()
pop_back()
Why is the default container for it a deque instead of a vector?
Don't deque ...
112
votes
11
answers
142k
views
Singleton design pattern vs Singleton beans in Spring container
As we all know we have beans as singleton by default in Spring container and if we have a web application based on Spring framework then in that case do we really need to implement Singleton design ...
104
votes
9
answers
106k
views
c++ deque vs queue vs stack
Queue and Stack are a structures widely mentioned. However, in C++, for queue you can do it in two ways:
#include <queue>
#include <deque>
but for stack you can only do it like this
#...
104
votes
9
answers
174k
views
docker compose orphan containers warning
How to be with orphan images when you have 2 independent projects and you want them to work at the same time or at least to build running docker-compose up -d without --remove-orphans flag when images ...
104
votes
4
answers
95k
views
What's the difference between std::multimap<key, value> and std::map<key, std::set<value> >
I found that they have one key and multiple values which is unique.
102
votes
13
answers
172k
views
Copy map values to vector in STL [duplicate]
Working my way through Effective STL at the moment. Item 5 suggests that it's usually preferable to use range member functions to their single element counterparts. I currently wish to copy all the ...
102
votes
7
answers
48k
views
How do you delete an AWS ECS Task Definition?
Once you've created a task definition in Amazon's EC2 Container Service, how do you delete or remove it?
99
votes
3
answers
124k
views
How to run amd64 docker image on arm64 host platform?
I have an m1 mac and I am trying to run a amd64 based docker image on my arm64 based host platform. However, when I try to do so (with docker run) I get the following error:
WARNING: The requested ...
94
votes
11
answers
41k
views
Docker in Docker cannot mount volume
I am running a Jenkins cluster where in the Master and Slave, both are running as a Docker containers.
The Host is latest boot2docker VM running on MacOS.
To allow Jenkins to be able to perform ...
93
votes
8
answers
145k
views
How can I use std::maps with user-defined types as key?
I'm wondering why I can't use STL maps with user-defined classes. When I compile the code below, I get the following cryptic error message. What does it mean? Also, why is it only happening with user-...
93
votes
7
answers
53k
views
Push docker image to amazon ecs repository
Im new to AWS. I want to set up a private docker repository on an AWS ECS container instance. I created a repository named name. The example push commands shown by AWS are working.
aws ecr get-login -...
90
votes
7
answers
400k
views
How to change the size of the font of a JLabel to take the maximum size
I have a JLabel in a Container.
The defaut size of the font is very small.
I would like that the text of the JLabel to take the maximum size.
How can I do that?
89
votes
3
answers
81k
views
How to configure a Kubernetes Multi-Pod Deployment
I would like to deploy an application cluster by managing my deployment via k8s Deployment object. The documentation has me extremely confused. My basic layout has the following components that scale ...
83
votes
7
answers
124k
views
Get Docker Container Names
This command gives me a list of running container IDs:
docker ps -q
Is there a command to get the list of names of the containers?
83
votes
10
answers
107k
views
How to generate a Postgresql Dump from a Docker container?
I would like to have a way to enter into the Postgresql container and get a data dump from it.
82
votes
7
answers
150k
views
wrapping Scaffold with Container for gradient background, How to set gradient to container background in flutter?
I'd like to wrap a Scaffold with a Container in order to get a gradient background that's also underneath the AppBar. Basically a full screen gradient background. However, my attempt doesn't do ...
82
votes
9
answers
89k
views
How can I reduce the disk space used by docker?
I am running docker on windows 10.
I had a couple of images stored in my machine. The total size of these images accumulated to around ~10GB. I have deleted these images via 'docker rmi -f' command.
...
80
votes
8
answers
51k
views
Container Class / Library for C [closed]
Does anyone know of any C container libraries? I am looking for something which gives standard implementations of linked lists, arrays, hash tables etc, much in the same way as the C++ STL does. Key ...
79
votes
3
answers
64k
views
What is an iterator's default value?
For any STL container that I'm using, if I declare an iterator (of this particular container type) using the iterator's default constructor, what will the iterator be initialised to?
For example, I ...
78
votes
5
answers
242k
views
Flutter Layout Container Margin
I have a problem with my Flutter Layout.
I have a simple container with a Margin right and left of 20.0
Inside this container i have another container.
But this container does not fit to the parent ...
76
votes
3
answers
73k
views
What exactly are "containers" in python? (And what are all the python container types?)
The python documentation frequently speaks of "containers". E.g. :
If check_circular is False (default: True), then the circular
reference check for container types will be skipped and a circular
...
75
votes
5
answers
99k
views
Cannot kill container: <container-id>: tried to kill container, but did not receive an exit event
I cannot stop, remove or kill my docker container. Commands given below with their respective error messages:
1. docker stop <container-id>
2. docker kill <container-id>
3. docker rm <...
75
votes
2
answers
32k
views
Difference between Kubernetes and Service Fabric
I have worked on Kubernetes and currently reading about Service Fabric, I know Service Fabric provides microservices framework models like stateful, stateless and actor but other than that it also ...