docker ps
docker images
docker pull ubuntu
docker start podid
docker run -itd -e TZ=Asia/Shanghai --name ubuntu-test -v /share:/shared -d ubuntu:latest
docker exec -it podid /bin/bash
apt-get install sudo
sudo apt update
apt-get install vim
sudo apt-get install language-pack-zh-hans
vim /etc/environment
追加:
LANG=“zh_CN.UTF-8”
LANGUAGE=“zh_CN:zh:en_US:en”
追加:vim /var/lib/locales/supported.d/local
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
zh_CN.GBK GBK
zh_CN GB2312
sudo locale-gen
sudo apt-get install fonts-droid-fallback ttf-wqy-zenhei ttf-wqy-microhei fonts-arphic-ukai fonts-arphic-uming
sudo apt-get install software-properties-common python-software-properties
sudo apt-get install python3.6
sudo apt-get update
sudo apt install python3-pip
pip3 install --upgrade pip
pip -V
sudo gedit /etc/apt/sources.list
sudo apt-get remove --auto-remove python3.8
sudo apt-get purge --auto-remove python3.8
sudo apt-get autoclea python3.8
sudo apt install mysql-server
mysql --version
service mysql status
service mysql start
service mysql stop
service mysql restart
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
mysql -uroot -p root
mysql->use mysql
mysql->update user set host = ‘%’ where user =‘root’;
mysql->grant all privileges on . to ‘root’@‘%’ with grant option;
mysql->flush privileges;
mysql->exit;
sudo /etc/init.d/mysql restart
sudo apt install net-tools
ifconfig
vim ~/.vimrc
输入:
set fileencodings=utf-8,gb2312,gbk,gb18030
set termencoding=utf-8
set fileformats=unix
set encoding=prc
python代码中加入:
import sys
import codecs
sys.stdout = codecs.getwriter(“utf-8”)(sys.stdout.detach())
第一行 :#!/bin/bash
执行逻辑:python run.py
保存文件
修改文件为执行权限
chmod +x ./shell.sh
编辑定时任务
crontab -e
查看定时任务
crontab -l
重启定时任务
service cron restart
启用ubuntu系统ssh链接
su -
sudo apt-get install openssh-server
sudo ps -e | grep ssh
sudo service ssh start
sudo systemctl enable --now ssh
sudo apt-get install net-tools
软连接python
sudo apt-get update
sudo apt-get install software-properties-common
sudo apt-get update
sudo apt-get install python-is-python3
sudo apt-get install python3-pip
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
docker 搭建私有镜像库,上传下载镜像
docker run --name registry -d -p 5000:5000 --restart=always -v /opt/data/registry:/var/lib/registry registry
docker run -itd --name ubuntu-dev --restart=always -v E:\share:/home/share ubuntu:latest
# 将正在运行的容器打包成镜像
docker commit ubuntu:latest 192.168.2.108:5000/ubuntu:latest
docker tag ubuntu:latest 192.168.2.108:5000/ubuntu:latest
vim /etc/docker/daemon.json
{
"insecure-registries": ["192.168.2.108:5000"]
}
sudo systemctl restart docker
docker push 192.168.2.108:5000/ubuntu:latest
docker pull 192.168.2.108:5000/ubuntu:latest