I experimented with Docker lately. Here are a few commands, notes and issues I resolved while working on Ubuntu 16.04. I'm assuming you have docker installed (sudo apt-get update && apt-get install docker-ce)
Tutorial on the web for "dockerizing" python applications. - https://runnable.com/docker/
Some python example code I made to test with (imgtest.py). This is the code I wanted to place in a docker image. I basically makes a random image and saves it.
Here is an example Dockerfile I used. I saved as Dockerfile and placed in same folder as my python script.
When building, had to add the DNS to the following (from https://stackoverflow.com/questions/28668180/cant-install-pip-packages-inside-a-docker-container-with-ubuntu). I tried other methods mentioned, but none of them seemed to work except this one. I also commented out the DockerOpts line in /etc/default/docker.
"For Ubuntu users
You need to add new DNS addresses in the docker config
sudo nano /lib/systemd/system/docker.
Add the dns after ExecStar.
--dns 10.252.252.252 --dns 10.253.253.253
Should look like that:
ExecStart=/usr/bin/dockerd -H fd:// --dns 10.252.252.252 --dns 10.253.253.253
systemctl daemon-reload sudo service docker restart
"
After your build you should be able to list the docker images available using the following command:
Additional commands below:
I can see the list of docker containers running or have run by using this command: