<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: David A.</title>
    <description>The latest articles on DEV Community by David A. (@duktigdev).</description>
    <link>https://dev.to/duktigdev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F782171%2F2cdae2e0-566a-44a2-88a3-820cb2e5b564.jpeg</url>
      <title>DEV Community: David A.</title>
      <link>https://dev.to/duktigdev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/duktigdev"/>
    <language>en</language>
    <item>
      <title>Docker - Messing/Mixing/Duplicating application variables in memory inside running containers.</title>
      <dc:creator>David A.</dc:creator>
      <pubDate>Tue, 28 Dec 2021 19:57:39 +0000</pubDate>
      <link>https://dev.to/duktigdev/docker-messingmixingduplicating-application-variables-in-memory-inside-running-containers-a6p</link>
      <guid>https://dev.to/duktigdev/docker-messingmixingduplicating-application-variables-in-memory-inside-running-containers-a6p</guid>
      <description>&lt;p&gt;Hi!&lt;/p&gt;

&lt;p&gt;I'm facing an issue with running docker containers by docker-compose. Before writing here, I tried all possible solutions, did research in google an so on. Still no luck! Hope, folks here can help me to figure out my issue related to docker running containers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Expected behavior
&lt;/h3&gt;

&lt;p&gt;Running 4 containers from same image&lt;br&gt;
Application running in docker container generates random data and creates json string.&lt;br&gt;
Each application running inside containers should generate/create unique values inside docker containers.&lt;/p&gt;
&lt;h3&gt;
  
  
  Actual behavior
&lt;/h3&gt;

&lt;p&gt;Running 4 containers from same image&lt;br&gt;
Applications running inside docker containers mixing a values and almost 70% is the same value.&lt;br&gt;
Assuming, issue with containers "shared" memory.&lt;br&gt;
Same application(s) running outside of docker container works perfect and generates unique values.&lt;/p&gt;

&lt;p&gt;Tested with PHP, Node.js, Golang. The issue is the same.&lt;/p&gt;
&lt;h3&gt;
  
  
  Steps to reproduce the behavior
&lt;/h3&gt;

&lt;p&gt;It's very complicated to reproduce the issue.&lt;br&gt;
But in some words you can imagine: &lt;/p&gt;

&lt;p&gt;Without docker containers creation, running 4 copies of the same application: Generates unique random values.&lt;/p&gt;

&lt;p&gt;Inside docker containers, applications running and 70% of values is the same.&lt;br&gt;
Assuming, a problem comes from container's memory stack.&lt;/p&gt;

&lt;p&gt;Using docker-compose to deploy containers:&lt;/p&gt;

&lt;p&gt;all 4 containers using the same image&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;container A Using Image "Myimg"
container B Using Image "Myimg"
container C Using Image "Myimg"
container D Using Image "Myimg"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output of &lt;code&gt;docker version&lt;/code&gt;:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Docker version 20.10.12, build e91ed57
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output of &lt;code&gt;docker info&lt;/code&gt;:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.7.1-docker)
  scan: Docker Scan (Docker Inc., v0.12.0)

Server:
 Containers: 8
  Running: 6
  Paused: 0
  Stopped: 2
 Images: 41
 Server Version: 20.10.12
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc version: v1.0.2-0-g52b36a2
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.13.0-22-generic
 Operating System: Ubuntu 21.10
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 15.54GiB
 Name: david-Macmini
 ID: FNY6:BSVD:L7JK:BFCW:ZCMP:6OMK:HM3I:U22T:WB2W:FCXM:4WC5:XS7B
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Running the docker in: Ubuntu 21.10 ( bare metal )&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>container</category>
      <category>memory</category>
    </item>
  </channel>
</rss>
