Ubuntu系統(tǒng)安裝使用Docker

環(huán)境配置

這次使用的是阿里云的云服務(wù)器ECS,選擇的是Ubuntu系統(tǒng),所以里面自帶apt-get,如果買的是輕量應(yīng)用服務(wù)器的話就是CentOS系統(tǒng)里面沒有自帶apt

apt是一個(gè)Ubuntu系統(tǒng)上一個(gè)軟件管理的工具,能夠幫助你自動(dòng)安裝軟件

但是如果直接安裝Docker的話不能直接安裝上最新的版本,所以需要先更新源,把docker的下載地址導(dǎo)入到apt的軟件安裝源里面

# 更新源
sudo apt update

#安裝Docker依賴的軟件
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

#添加需要的安裝來源
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -    #下載源將其添加到apt的安裝里面

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"       #對(duì)剛剛安裝的源進(jìn)行注冊(cè)

#安裝docker以及器需要的別的包
sudo apt install docker-ce docker-ce-cli containerd.io

#添加用戶因?yàn)槠胀ㄓ脩舨荒苁褂胐ocker
#當(dāng)然我們買的云服務(wù)器是root權(quán)限的,所以可以不需要添加用戶
sudo usermod -aG docker 用戶名

# 查看docker是否正常啟動(dòng)
sudo service docker status

docker正常啟動(dòng)情況


Docker正常運(yùn)行

小tips:查看服務(wù)器的系統(tǒng)
我還以為阿里云服務(wù)器默認(rèn)系統(tǒng)就是Ubuntu系統(tǒng),沒想到輕量級(jí)應(yīng)用服務(wù)器用的是centos系統(tǒng)
然后去到官網(wǎng)找到相應(yīng)的系統(tǒng)的下載方法
Install Docker Engine on Ubuntu

lsb_release -a          # 查看服務(wù)器的版本號(hào)

管理docker服務(wù)

docker 需要一個(gè)后臺(tái)的守護(hù)進(jìn)程,這個(gè)守護(hù)進(jìn)程可以用下面命令管理


sudo service docker start                       #啟動(dòng)docker服務(wù)

sudo service docker restart                     #重啟服務(wù)

sudo service docker stop                        #暫停服務(wù)

sudo service docker status                      #確認(rèn)docker的運(yùn)行狀態(tài)

下載管理docker鏡像

這里需要到docker的官網(wǎng)去查找需要的鏡像Docker Hubhttps://hub.docker.com/

查找鏡像

去里面搜索需要的鏡像然后復(fù)制代碼即可
docker中的鏡像都是放在一個(gè)公共的地方統(tǒng)一進(jìn)行管理的,所以在下載鏡像之后不會(huì)直接看到鏡像存在的目錄,但是如果是同一個(gè)服務(wù)器下的用戶也能看到別人的鏡像

# 下載 最新的Ubuntu鏡像

docker pull ubuntu 

# 查看所有的鏡像

docker images

#刪除指定的鏡像
docker rmi ubuntu(名字或者ID號(hào))

# 搜索需要的鏡像
docker search 

# 下載進(jìn)行
docker pull 

管理容器

#使用交互模式it啟動(dòng)ubuntu容器 并且進(jìn)入到bash里面
docker run -it ubuntu bash

# 退出Ubuntu容器
exit

# 查看所有的容器
docker ps -a

# 交互式啟動(dòng)容器
docker exec -it 5479ee15b24f bash

# 直接運(yùn)行容器
docker exec 5479ee15b24f pwd

# 停止容器

docker stop 5479ee15b24f 

# 刪除容器
docker rm 5479ee15b24f 

在Ubuntu中安裝blast軟件

#創(chuàng)建交互模式的Ubuntu
docker run -it ubuntu bash

# 使用apt來安裝wget
apt update

apt install wget

# 使用官網(wǎng)鏈接來下載blast
wget https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/ncbi-blast-2.12.0+-x64-linux.tar.gz

tar -zxvf ncbi-blast-2.12.0+-x64-linux.tar.gz           #解壓

# 測(cè)試blast能否使用
/opt/ncbi-blast-2.12.0+/bin/blastp


制作鏡像

#將安裝有blast的Ubuntu容器制作成指定名稱的鏡像

docker commit -m 'add blast' 6c09e5192928 xyf/blast
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容