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 are available in most programming languages, allowing programmers to store, transfer, and read back data within a program. Common containers include arrays, lists, queues, stacks, sets, and maps, each providing different levels of efficiency for tasks such as adding or removing elements, searching for elements, or iterating through elements.

11206 questions
151
votes
16 answers

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 "rabbitmq" as seen under the NAMES column in a bash…
Robbo_UK
  • 11,351
  • 25
  • 81
  • 117
150
votes
13 answers

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 a container and stop configuring the kernel. Now…
harryz
  • 4,980
  • 6
  • 31
  • 34
149
votes
8 answers

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 volumes to store the data associated with applications…
Dinesh Reddy
  • 1,594
  • 2
  • 11
  • 9
145
votes
5 answers

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 any way to increase the size of /dev/shm in docker…
user2521791
  • 1,621
  • 2
  • 14
  • 13
142
votes
6 answers

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: lsb_release: command not found root@471bdb08b11a:/#…
kramer65
  • 50,427
  • 120
  • 308
  • 488
140
votes
8 answers

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 something like: h = heapq.heapify([...], key=my_lt_pred) h…
vsekhar
  • 5,090
  • 5
  • 22
  • 23
135
votes
4 answers

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 how each is used?
tusharfloyd
  • 1,732
  • 3
  • 14
  • 18
134
votes
19 answers

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 concept of percentages, so I could just set height…
Mary
  • 18,347
  • 23
  • 59
  • 76
131
votes
9 answers

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?
Andy59469
  • 1,674
  • 2
  • 13
  • 18
128
votes
9 answers

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?
user3067875
  • 1,291
  • 2
  • 9
  • 4
115
votes
7 answers

How to SSH into Docker?

I'd like to create the following infrastructure flow: How can that be achieved using Docker?
Kamil Lelonek
  • 14,592
  • 14
  • 66
  • 90
112
votes
11 answers

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 pattern to hold global data rather than just…
Peeyush
  • 1,121
  • 2
  • 8
  • 3
112
votes
2 answers

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 reallocations give a buffer of elements before front() so that…
Greg Rogers
  • 35,641
  • 17
  • 67
  • 94
107
votes
11 answers

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: > docker build ... > docker run CONTAINER_TAG >…
Franco Rabaglia
  • 1,163
  • 2
  • 9
  • 9
104
votes
4 answers

What's the difference between std::multimap and std::map >

I found that they have one key and multiple values which is unique.
superK
  • 3,932
  • 6
  • 30
  • 54