使用tmpfs卷时记忆计算错误

我有一个工作负载,我想用一个容器将数据写入从主机挂载的-tmpfs卷。 我希望写入卷的数据不会计入Docker对写入容器的内存限制。 但是,写入主机安装卷的数据似乎计入容器的内存限制。 这是正确的行为? 有没有办法让容器写入比内存限制更多的数据到主机的内存?

从运行amazon linux的新configuration的EC2机器复制步骤:

sudo yum install -y docker # Mount a 5GB tmpfs sudo mkdir /mnt/tmpfs && sudo mount -t tmpfs -o size=5G tmpfs /mnt/tmpfs # Get some data. This file is 3GB wget https://datasets.elasticmapreduce.s3.amazonaws.com/ngrams/books/20090715/eng-us-all/1gram/data --no-check-certificate sudo service docker start sudo docker run --rm --memory=2G -it -v /mnt/tmpfs:/mnt/tmpfs -v ~/data:/data ubuntu /bin/bash # Inside the container now cp /data /mnt/tmpfs # The cp command gets killed 

如果我们没有设置2G内存限制,则拷贝将成功完成。