~❯ brew update && brew upgrade && brew cask upgrade && brew cleanup && brew doctor
to get brew ready~❯ brew cask install docker-edge
~❯ echo "export DOCKER_CONFIG=$XDG_CONFIG_HOME/docker" >> $ZDOTDIR/.zshenv
~❯ mkdir -p ~/Docker/ubuntu
to create a new working directory~❯ cd ~/Docker/ubuntu
step into the the newly created direactory~/D/ubuntu ❯ docker pull ubuntu
to pull the latest ubutu image~/D/ubuntu ❯ echo "FROM ubuntu:latest\nCMD /bin/bash" > Dockerfile
create a minimum Dockerfile
-
~/D/ubuntu ❯ docker image build --tag roalcantara/ubuntu:01 .
to build the image -
~/D/ubuntu ❯ docker image ls --all
to list the newly build imageREPOSITORY TAG IMAGE ID CREATED SIZE ubuntu latest adafef2e596e 3 hours ago 73.9MB roalcantara/ubuntu 01 adafef2e596e 3 hours ago 73.9MB -
~/D/ubuntu ❯ docker image rm adafef2e596e
to remove the imageroalcantara/ubuntu
-
~/D/ubuntu ❯ docker container ls --all
to list containersCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ed7c77d5fa07 roalcantara/ubuntu:01 "/bin/bash" 22 minutes ago Created ubuntu -
~/D/ubuntu ❯ docker container start ubuntu
and start one or more stopped containers -
~/D/ubuntu ❯ docker container stop ubuntu
and stop one or more running containers -
~/D/ubuntu ❯ docker container attach ubuntu
and attatech to a running container -
~/D/ubuntu ❯ docker container rm ubuntu
and remove one or more containers -
~/D/ubuntu ❯ docker run --name ubuntu --detach roalcantara/ubuntu:01
to run this container in the background -
~/D/ubuntu ❯ docker container run -it --rm --entrypoint /bin/bash --name ubuntu roalcantara/ubuntu:01
to run an interactive command in a new container and automatically remove the container when it exits
~/D/ubuntu ❯ docker login
to login to Docker Hub~/D/ubuntu ❯ docker tag ubuntu:1.0 roalcantara/ubuntu:01
to tag the image~/D/ubuntu ❯ docker push roalcantara/ubuntu:01
to publish the image
~/D/ubuntu ❯ docker rm $(docker ps -qaf status=exited)
and clean up exited containers~/D/ubuntu ❯ docker rmi $(docker images -qf dangling=true)
and clean up dangling images~/D/ubuntu ❯ docker volume rm $(docker volume ls -qf dangling=true)
and clean up exited containers~/D/ubuntu ❯ docker stop $(docker ps -a -q)
to stop all contaiers~/D/ubuntu ❯ docker rm $(docker ps -a -q)
to remove all contaiers~/D/ubuntu ❯ docker rm $(docker ps -a -f status=exited -q)
to remove all exited containers~/D/ubuntu ❯ docker rmi $(docker images -a -q)
to remove all images
~/D/ubuntu ❯ docker image prune
and prune all images~/D/ubuntu ❯ docker container prune
and prune all containers~/D/ubuntu ❯ docker volume prune
and prune all volumes~/D/ubuntu ❯ docker system prune
and remove unused images~/D/ubuntu ❯ docker system prune --all
and remove any stopped containers and all unused images
docker cp ./localfile.sql containername:/container/path/file.sql
docker exec -u postgresuser containername psql dbname postgresuser -f /container/path/file.sql