Code Monkey home page Code Monkey logo

docker-commands's Introduction

Docker Images

How to use a imagen?

docker images
/* List all images */

docker pull debian
/* Download a imagen */

docker pull debian:8
/* Download a imagen with specific tag */

Docker Containers

How to create/delete a container?

docker container ps
/* List all container initiated */
-a
-l

docker run -it ubuntu
/* Created container name by default */

docker run -it --name containerUbuntu ubuntu
/* Created container name assigned */

docker run -it --name containerUbuntu -d ubuntu
/* Start a container in detached mode */
-p
-m "500mb"
-cpuset-cpus 0-1
--rm


docker cp index.html apache:/tmp
docker cp apache:/va/httpd

docker rm <CONTAINER-NAME OR CONTAINER-ID>
/* Delete container */

How to start/stop a container?

docker start <CONTAINER-NAME OR CONTAINER-ID>
/* Start container */

docker stop <CONTAINER-NAME OR CONTAINER-ID>
/* Stop container */

Another options from container

docker exec -it containerDebian bash
docker exec -it containerDebian -c "cat /etc/os-release"
/* Access a started container */

docker port <CONTAINER-NAME OR CONTAINER-ID>
/* List port mappings or a specific mapping for the container */

docker inspect <CONTAINER-NAME OR CONTAINER-ID>
/* Container detail  */

docker logs <CONTAINER-NAME OR CONTAINER-ID>
/* Fetch the logs of a container */
-f

docker stats <CONTAINER-NAME OR CONTAINER-ID>
/* Display a live stream of container(s) resource usage statistics */

docker commit <CONTAINER-NAME OR CONTAINER-ID> <IMAGE_NAME>

docker info
/* Directory today */

Docker Network

docker network ls
/* List all network */

docker network create <NETWORK_NAME>
/* Using driver bridge */

docker network inspect <NETWORK_NAME>
/* Inspect created network */

docker network -d bridge --subnet <IP-0>/24 --gateway <IP-1> <NETWORK_NAME>
/* Assign gateway and subnet */

docker run --network <NETWORK_NAME> -it --name containerDebian debian
docker run --network <NETWORK_NAME> --ip <IP-X> -it --name containerDebian debian
/* Create container with created network */

docker network connect <NETWORK_NAME> <CONTAINER_NAME>
/* Connect containers in different networks */

docker network disconnect <NETWORK_NAME> <CONTAINER_NAME>
/* Disconnect a container from a network */

docker network rm <CONTAINER_NAME>
/* Delete created network */

docker network rm <CONTAINER_NAME>
/* Assign IP to a container */

docker run --network host -it --name containerDebian debian
/* Create container in host network */

docker run --network none -it --name containerDebian debian
/* Create container in host network */

Support or Contact

Having trouble with Pages? Check out our documentation or contact support and we’ll help you sort it out.

docker-commands's People

Contributors

danycenas avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.