code-server 問題解決

code-server官網命令下載很慢或無法下載

https://github.com/cdr/code-server

官方文檔中的

docker run -it -p 127.0.0.1:8080:8080 -v “HOME/.local/share/codeserver:/home/coder/.local/share/codeserver"v"{HOME}/.local/share/code-server:/home/coder/.local/share/code-server" -v "PWD:/home/coder/project” codercom/code-server:v2

輸入後無法下載或下載很慢

考慮可能是docker源的問題,筆者已經換了阿里的源,更改爲網易源和官方docker-cn源後中間那段c開頭的直接無法下載,於是換回阿里,在一次嘗試失敗後突然飛速下載,未解之謎。

code-server 無法運行,提示權限問題

經過查找資料,應該在 run 後面加入參數 --user root 以管理員權限運行如下

docker run --user root -it -p 127.0.0.1:8080:8080 -v “HOME/.local/share/codeserver:/home/coder/.local/share/codeserver"v"{HOME}/.local/share/code-server:/home/coder/.local/share/code-server" -v "PWD:/home/coder/project” codercom/code-server:v2

code-server 容器已經運行,但是無法訪問

筆者另外一個tomcat容器能夠正常訪問,防火牆也改過,初步排除是docker宿主機的問題,後經友人提醒docker默認只是監聽0.0.0.0而不是127.0.0.1,更改如下

docker run --user root -it -p 0.0.0.0:8080:8080 -v “HOME/.local/share/codeserver:/home/coder/.local/share/codeserver"v"{HOME}/.local/share/code-server:/home/coder/.local/share/code-server" -v "PWD:/home/coder/project” codercom/code-server:v2

無法安裝python

安裝python命令

apt-get install python3
cd /usr/bin
mv python3 python

網上查到資料
V2 版本中無法在 vscode 中添加 python 配置,試用版中可以,於是這條命令繼續更改如下

docker run --user root -it -p “8080:8080” -v “/your/path/vscode/project:/home/coder/project” docker.io/codercom/code-server:2.1523-vsc1.38.1

下面是結尾可以加的兩個參數 代表允許https和password
//–allow-https --auth password

apt-get無法下載python

換源:詳見:
https://blog.csdn.net/oDeviloo/article/details/53893739
//當天下午更新,發現這個沒用
因爲我搞錯系統了

cd /etc
ls
發現有個os-release的文件
打開看到是ubuntu系統而不是centos
暈倒
重來

編輯/etc/apt/sources.list

##中科大源

deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

sudo apt-get update
sudo apt-get upgrade

終於正常了

成功在電腦瀏覽器中運行python

在這裏插入圖片描述

無法打開命令行the terminal process terminated with exit code 1

使用管理員運行docker

ipad訪問概率性導致容器意外退出

未解決

備忘

進入

docker run --user root --name codetest -p 8080:8080 0a

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章