Pages

Sunday 22 July 2018

dockercheatsheet

Docker Commands:
-----------------------------------------------------

== Build image and run it ==
Only needed the first time to build it, after it was built first time use
the “sudo docker-compose up” only, no need for the “--build”

sudo docker-compose up --build

== run image ==
# no need to supply the build flag "--build' because the it is already built.
Can only use after --build has been done once. Done this way cause it spins
up in less than a second.

sudo docker-compose up


== Stopping docker ==

ctrl + c
sudo docker-compose stop

== Shows the current docker images ==

sudo docker images

== Show running containers in current .yml file ==
Shows the running containers on the system and the state containers are in

sudo docker-compose ps

== Shows the all running containers on the system ==

sudo docker ps

== clearing docker "mess" ==
This will clear out the stopped container we just ran. if we didn't do this,
we would get an error from docker-compose saying it cant create a container
with the same file name.

sudo docker-compose rm -f

== clearing docker "mess" weekly one==
Run this once a week else docker will start to use up alot of disk space.

sudo docker rmi -f $(docker images -qf dangling=true)


sudo docker-compose find container ip address
docker inspect <container id> | grep "IPAddress"


Docker compose testing commands:
sudo docker-compose exec website py.test snakeeyes/tests


sudo docker-compose exec website py.test snakeeyes/tests


sudo docker-compose exec website py.test --cov-report term-missing --cov snak
eeyes


sudo docker-compose exec website flake8 .

sudo docker-compose exec website flake8 . --exclude __init__.py

No comments:

Post a Comment

Mid Journey Astronaut Art