You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Running a container# '-d' flag: Run container in background and print container ID# '--name string' flag: Assign a name to the container# '-p' flag: Publish a container's port(s) to the host
docker container run -d --name [container name] \
-p [Docker host port]: [App listen port] \
[Docker Hub ID]/[Git Repo Name]:[Image Name]
# Example:
docker container run -d --name web -p 8000:8080 \
mickio/gsd:first-ctr
Run an internactive container
# '--name string' flag: Assign a name to the container# '-i' flag: Keep STDIN open even if not attached# '-t' flag: Allocate a pseudo-teletypewriter
docker container run -it --name [Container Name] [Imagine] [App]
docker container run -it --name test apline sh
# ctrl+P+Q to escape the container without killing it
Stop a container
docker container stop [Container ID | Container Name]
Delete a container
docker container rm [Container ID | Container Name]
# Build a Docker image# '-t' flag: Name and optionally a tag in the 'name:tag' format# 'dir' should be the directory where the Dockerfile is located.
docker image build -t [Docker Hub ID]/[Git Repo Name]:[Image Name] [dir]
# List your local Docker images to ensure the image was sucessfully created
docker image ls
Pushing a Docker image to a repository
# Push a Docker image to a repository
docker image push [Docker Hub ID]/[Git Repo Name]:[Image Name]