Kohshi's Blog
2016/10/23
dockerをインストール@Ubuntu14:04
基本は以下の手順通りに行う * https://docs.docker.com/engine/installation/linux/ubuntulinux/ 1. Prerequisitesのインストール apt source listを追加する際に書き込みがsudoできないのでできないのでteeとか使ってやる。 ``` $ sudo apt-get update $ sudo apt-get install apt-transport-https ca-certificates $ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D apt sourceの追加(sourceはUbuntu versionごとに違うので注意) $ echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list ``` aufs storage driverなるものが使えるようになるので以下をインストールしろと言われるがlinux-image-extra-virtualを入れようとすると以下の依存エラーが起きた ``` $ sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual ``` 依存エラー ``` The following packages have unmet dependencies: linux-image-extra-virtual : Depends: linux-image-generic (= 3.13.0.100.108) but 3.13.0.92.99 is to be installed E: Unable to correct problems, you have held broken packages. ``` これはいったん、linux-image-genericをpurgeしてreinstallすることで対応できた ``` $sudo apt-get purge linux-image-generic $sudo apt-get install --reinstall linux-image-generic ``` 1. dockerインストール ``` Log into your Ubuntu installation as a user with sudo privileges. Update your APT package index. $ sudo apt-get update Install Docker. $ sudo apt-get install docker-engine Start the docker daemon. $ sudo service docker start Verify docker is installed correctly. $ sudo docker run hello-world This command downloads a test image and runs it in a container. When the container runs, it prints an informational message. Then, it exits. ``` hello-worldを実行すると以下がでて正しくインストールできたっぽいことがわかる ``` Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker Hub account: https://hub.docker.com For more examples and ideas, visit: https://docs.docker.com/engine/userguide/ ``` ## Tips ### proxy docker.ioへ接続する際のproxy設定は /etc/default/dockerへ以下を記載する ``` export http_proxy="http://proxy.hoge.com:XXXXXX" ``` 変更後はdockerのrestartが必要 ``` $sudo service docker restart ``` ### sudoなしdocker実行 installation pageにもあるがdockerグループを作成して、そこにユーザを入れることでsudoなしでもdockerコマンドが実行できるようになる。 グループへ追加後、対象ユーザで作業している場合にはログアウト → 再ログインが必要なので注意
ツイート
0 件のコメント:
コメントを投稿
次の投稿
前の投稿
ホーム
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿