Last active
August 29, 2015 14:12
-
-
Save smile-0yen/a396c97a89ff8bc271f5 to your computer and use it in GitHub Desktop.
Dockerの基本操作をCentOS 7で確認 その1 ref: http://qiita.com/smile-0yen/items/c6957b951ca0fdb8acc7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ mkdir dockerenv && cd dockerenv | |
$ vagrant init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.require_version ">= 1.6.3", "< 1.9.9" | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.boot_timeout = 60 | |
config.vm.box = "centos-7.0" | |
config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-7.0_chef-provisionerless.box" | |
config.vm.hostname = "docker-centos7-01" | |
config.vm.network "forwarded_port", guest: 80, host: 8888 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
first_container | |
Hello Docker! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ mkdir /tmp/docker | |
$ echo 'Test Server running inside a container.' > /tmp/docker/test.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo docker run --rm -ti -v /tmp/docker:/opt -p 80:8080 ubuntu:14.04 /bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sudo apt-get install ruby -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ruby -run -e httpd . -p 8080 | |
[2014-12-31 10:02:35] INFO WEBrick 1.3.1 | |
[2014-12-31 10:02:35] INFO ruby 1.9.3 (2013-11-22) [x86_64-linux] | |
[2014-12-31 10:02:35] WARN TCPServer Error: Address already in use - bind(2) | |
[2014-12-31 10:02:35] INFO WEBrick::HTTPServer#start: pid=2651 port=8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ vagrant up | |
$ vagrant ssh | |
$ sudo yum install docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo systemctl enable docker.service | |
$ sudo systemctl start docker.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo systemctl status docker.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo docker version | |
Client version: 1.3.2 | |
Client API version: 1.15 | |
Go version (client): go1.3.3 | |
Git commit (client): 39fa2fa/1.3.2 | |
OS/Arch (client): linux/amd64 | |
Server version: 1.3.2 | |
Server API version: 1.15 | |
Go version (server): go1.3.3 | |
Git commit (server): 39fa2fa/1.3.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo docker info | |
Containers: 4 | |
Images: 8 | |
Storage Driver: devicemapper | |
Pool Name: docker-253:1-134297046-pool | |
Pool Blocksize: 65.54 kB | |
Data file: /var/lib/docker/devicemapper/devicemapper/data | |
Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata | |
Data Space Used: 860 MB | |
Data Space Total: 107.4 GB | |
Metadata Space Used: 1.368 MB | |
Metadata Space Total: 2.147 GB | |
Library Version: 1.02.84-RHEL7 (2014-03-26) | |
Execution Driver: native-0.2 | |
Kernel Version: 3.10.0-123.el7.x86_64 | |
Operating System: CentOS Linux 7 (Core) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo docker pull ubuntu:14.04 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo docker images | |
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE | |
ubuntu 14.04.1 ed5a78b7b42b 2 days ago 192.7 MB | |
ubuntu trusty ed5a78b7b42b 2 days ago 192.7 MB | |
ubuntu 14.04 ed5a78b7b42b 2 days ago 192.7 MB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo docker run -i -t -h 'first_container' --rm ubuntu:14.04 hostname && echo 'Hello Docker!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment