A. 在vmware裏安裝ubuntu,login登錄後桌面空白的問題。
查了很多資料,各種折騰。最後是通過 virtual machine settings --》hardware --》display ,右側 取消選擇 accelerate 3D graphics的複選框解決。
B. 安裝docker
- Update the
apt
package index:
$ sudo apt-get update
Install packages to allow apt
to use a repository over HTTPS:
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
Add Docker’s official GPG key:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add
1.Update the apt package index:
$ sudo apt-get update
2.Install packages to allow apt to use a repository over HTTPS:
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
3.Add Docker’s official GPG key:
$ gpg --import KEYS
$ sudo apt-get update
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add
Verify that the key fingerprint is 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
.
$ sudo apt-key fingerprint 0EBFCD88
pub 4096R/0EBFCD88 2017-02-22
Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid Docker Release (CE deb) <[email protected]>
sub 4096R/F273FCD8 2017-02-22
4.
Use the following command to set up the stable repository. You always need thestable repository, even if you want to install builds from theedge or
test repositories as well. To add the edge ortest repository, add the word
edge
ortest
(or both) after the wordstable
in the commands below.
Note: The
lsb_release -cs
sub-command below returns the name of your Ubuntu distribution, such asxenial
. Sometimes, in a distribution like Linux Mint, you might have to change$(lsb_release -cs)
to your parent Ubuntu distribution. For example, if you are usingLinux Mint Rafaela
, you could usetrusty
.
amd64:
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
如果出錯,將錯誤信息輸入檢索。到一個www.digitallocean.com的網站找原語句。
5. 更新apt-get
Update the apt
package index.
$ sudo apt-get update
6. 列出所有可用docker版本
On production systems, you should install a specific version of Docker CE instead of always using the latest. This output is truncated. List the available versions.
$ apt-cache madison docker-ce
docker-ce | 17.06.0~ce-0~ubuntu | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
7、安裝特定版本
$ sudo apt-get install docker-ce=<VERSION>
(尖括號去掉 =號後面直接寫版本名稱)
8. Manage Docker as a non-root user
The docker
daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the userroot
and other users can only access it usingsudo
.
The docker
daemon always runs as the
root
user.
If you don’t want to use sudo
when you use thedocker
command, create a Unix group calleddocker
and add users to it. When thedocker
daemon starts, it makes the ownership of the Unix socket read/writable by thedocker
group.
Warning: The
docker
group grants privileges equivalent to theroot
user. For details on how this impacts security in your system, seeDocker Daemon Attack Surface.
To create the docker
group and add your user:
-
Create the
docker
group.$ sudo groupadd docker
-
Add your user to the
docker
group.$ sudo usermod -aG docker $USER
-
Log out and log back in so that your group membership is re-evaluated.
If testing on a virtual machine, it may be necessary to restart the virtual machine for changes to take affect.
On a desktop Linux environment such as X Windows, log out of your session completely and then log back in.
-
Verify that you can run
docker
commands withoutsudo
.$ 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 and exits.
C. 安裝tensorflow
第一次運行該命令,會先從本地查找,本地找不到後會到服務器下載docker的tensorflow鏡像。
sudo docker run -it -p 8888:8888 -p 6006:6006 tensorflow/tensorflow
瀏覽器打開jupyter notebook http://localhost:8888/ (然後瀏覽器打開jupyter notebook http://localhost:8888/?token=98c3d07b555da904d2cd49b032f9d3cbb20aa2a74e681ac3 ) 6006是爲tensorboard開的端口。或者
docker run -it gcr.io/tensorflow/tensorflow bash
在命令窗口中運行python指令或程序。 docker exec -i -t 6a86d814de16/bin/bash (數字ID根據具體機器上的docker container ID來定) (docker ps 查看所有鏡像 )