Last active
February 20, 2021 11:24
-
-
Save StuartsHome/4eb40e6930a4cfc0026ab3a283c9a0a6 to your computer and use it in GitHub Desktop.
Docker Commands and Info
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Build image - go to the root directory where the image is located: | |
| $ docker build -t <imagename> . | |
| Run Container: | |
| $ docker run -d -p 5000:5000 <imagename> | |
| Query the container port to see if running: | |
| $ docker ps | |
| $ curl http://localhost:5000 | |
| Stop Container: | |
| $ docker stop <containerid> | |
| Delete image: | |
| $ docker image rm <imageid> | |
| Delete image Force: | |
| $ docker image rm -f <imageid> | |
| List Containers: | |
| $ docker ps -a | |
| List images: | |
| - $ docker images | |
| Check if Docker Running: | |
| $ docker info | |
| Execute Bash on container: | |
| - $ docker exec -it <nameofcontainer> bash | |
| Enter PostgreSQL from container's bash: | |
| - $ psql -U postgres | |
| Updating a Docker image: | |
| 1. Remove previous image | |
| 2. Build image | |
| 3. Run container |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment