~❯ brew update && brew upgrade && brew cask upgrade && brew cleanup && brew doctorto get brew ready~❯ brew cask install docker-edge~❯ echo "export DOCKER_CONFIG=$XDG_CONFIG_HOME/docker" >> $ZDOTDIR/.zshenv
~❯ mkdir -p ~/Docker/ubuntuto create a new working directory~❯ cd ~/Docker/ubuntustep into the the newly created direactory~/D/ubuntu ❯ docker pull ubuntuto pull the latest ubutu image~/D/ubuntu ❯ echo "FROM ubuntu:latest\nCMD /bin/bash" > Dockerfilecreate a minimum Dockerfile
-
~/D/ubuntu ❯ docker image build --tag roalcantara/ubuntu:01 .to build the image -
~/D/ubuntu ❯ docker image ls --allto 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 adafef2e596eto remove the imageroalcantara/ubuntu
-
~/D/ubuntu ❯ docker container ls --allto 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 ubuntuand start one or more stopped containers -
~/D/ubuntu ❯ docker container stop ubuntuand stop one or more running containers -
~/D/ubuntu ❯ docker container attach ubuntuand attatech to a running container -
~/D/ubuntu ❯ docker container rm ubuntuand remove one or more containers -
~/D/ubuntu ❯ docker run --name ubuntu --detach roalcantara/ubuntu:01to run this container in the background -
~/D/ubuntu ❯ docker container run -it --rm --entrypoint /bin/bash --name ubuntu roalcantara/ubuntu:01to run an interactive command in a new container and automatically remove the container when it exits
~/D/ubuntu ❯ docker loginto login to Docker Hub~/D/ubuntu ❯ docker tag ubuntu:1.0 roalcantara/ubuntu:01to tag the image~/D/ubuntu ❯ docker push roalcantara/ubuntu:01to 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 pruneand prune all images~/D/ubuntu ❯ docker container pruneand prune all containers~/D/ubuntu ❯ docker volume pruneand prune all volumes~/D/ubuntu ❯ docker system pruneand remove unused images~/D/ubuntu ❯ docker system prune --alland 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