You can get the saved docker image by:
docker pull ahope2019/ubuntu_python3_tool
Following are the steps I did before.
-
add mirror
-
find exist image
find an image in dock hub.
https://hub.docker.com/r/fnndsc/ubuntu-python3/dockerfile -
get&run image
docker pull fnndsc/ubuntu-python3
docker run -itd --name ubuntu_python3 -p 9977:22 d755
docker exec -it <container_id> /bin/bash
docker image ls
docker ps
docker ps -a
docker rm <container_id>
docker logs <container_id>
$ docker exec -it 8df /bin/bash
root@8df195cdd716:/# ls
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
root@8df195cdd716:/# python
Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
- apt-get update error
I can’t use apt-get to install software and I can’t use vim.
So I use the following commands to modify “sources.list”.
echo “deb http://old-releases.ubuntu.com/ubuntu/ maverick main restricted universe multiverse”>>/etc/apt/sources.list
echo “deb http://old-releases.ubuntu.com/ubuntu/ maverick-updates main restricted universe multiverse”>>/etc/apt/sources.list
echo “deb http://old-releases.ubuntu.com/ubuntu/ maverick-security main restricted universe multiverse”>>/etc/apt/sources.list
reference:
https://stackoverflow.com/questions/25291686/ubuntu-can-not-install-software-properties-common
https://blog.csdn.net/potianliu/article/details/80600230
- install software
apt-get install sudo
在sources.list文件中加入了非ubuntu官方源,所以認爲加入源是不可信任的。
解決方法
導入該源公鑰。E084DAB9爲上圖中公鑰後八位
gpg --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
gpg --export --armor 40976EAF437D05B5 | sudo apt-key add -
原文鏈接
apt-get install sudo
sudo passwd root
apt-get install openssh-server –fix-missing
service ssh start
vi /etc/ssh/sshd_config
#PermitRootLogin prohibit-password
PermitRootLogin yes
service ssh restart
apt-get install vsftpd –fix-missing
修改配置文件/etc/vsftpd.conf
listen=YES
local_enable=YES
write_enable=YES
anonymous_enable=YES
service vsftpd start
- save image
docker commit 容器名 鏡像名
docker save -o 保存的文件名 鏡像名
docker load -i 鏡像文件名
push to docker hub
$ docker tag ubuntu_python3_xw:latest ahope2019/ubuntu_python3_tool:init_env
$ docker push ahope2019/ubuntu_python3_tool:init_env
docker rmi $(docker image ls -a -q)
- mount local directory
docker run -itd --name ubuntu_tool -p 9977:22 -v /Users/xiongwei/Downloads/my_project/github_directory/debug_tool:/usr/src/debug_tool 008
apt-get install python3-venv --fix-missing
- windows install docker
https://www.runoob.com/docker/windows-docker-install.html