Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
1
Help us understand the problem. What is going on with this article?
@haniokasai

Ubuntu 18.04上のDockerでコンテナのベースサイズを自在に変える

More than 1 year has passed since last update.

関連記事

Docker info

# docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 18.09.7
Storage Driver: overlay2
 Backing Filesystem: xfs
 Supports d_type: true
 Native Overlay Diff: true

無設定時

#  docker run --storage-opt size=5g -t -i ubuntu /bin/bash
Unable to find image 'ubuntu:latest' locally
^[[2~latest: Pulling from library/ubuntu
5b7339215d1d: Pull complete 
14ca88e9f672: Pull complete 
a31c3b1caad4: Pull complete 
b054a26005b7: Pull complete 
Digest: sha256:9b1702dcfe32c873a770a32cfd306dd7fc1c4fd134adfb783db68defc8894b3c
Status: Downloaded newer image for ubuntu:latest
docker: Error response from daemon: --storage-opt is supported only for overlay over xfs with 'pquota' mount option.
See 'docker run --help'.

grubの編集

vi /etc/default/grub

GRUB_CMDLINE_LINUX に "rootflags=uquota,pquota" を追加。

sudo grub-mkconfig -o /boot/grub/grub.cfg
docker run --storage-opt size=5g -t -i ubuntu /bin/bash
root@67f434ee5ab8:/# df -h
Filesystem      Size  Used Avail Use% Mounted on
overlay         5.0G  8.0K  5.0G   1% /
tmpfs            64M     0   64M   0% /dev
tmpfs           2.8G     0  2.8G   0% /sys/fs/cgroup
/dev/sda5        55G  8.2G   47G  16% /etc/hosts
shm              64M     0   64M   0% /dev/shm
tmpfs           2.8G     0  2.8G   0% /proc/asound
tmpfs           2.8G     0  2.8G   0% /proc/acpi
tmpfs           2.8G     0  2.8G   0% /proc/scsi
tmpfs           2.8G     0  2.8G   0% /sys/firmware
root@67f434ee5ab8:/# 

サイズが変わった。

1
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
haniokasai
男子大学生の暇人です。ブログで活動していましたが。VPSオタク。アンチGCPとAWS。国内外のサーバーをたくさん借りてました。JavaとPythonを主に使います。 アイコンはらてちさんから。

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
1
Help us understand the problem. What is going on with this article?