DEV Community

Marco Cobian
Marco Cobian

Posted on

1

7 pasos para subir imagen a docker hub

  1. primero es necesario tener una imagen creada en este caso se tiene este script con python

    app.py

    #!/usr/bin/python3
    import time
    
    print("hello world")
    
    time.sleep(200)
    

    Dockerfile

    FROM ubuntu:latest
    
    RUN apt update && apt install -y python3
    
    COPY app.py /app.py
    
    # ENTRYPOINT ["python3"]
    
    CMD ["python3","/app.py"]
    
    # 36:30
    
  2. Despues creamos la imagen en caso de que no se tenga con docker build -t app-python:latest .

    docker images | grep app
    app-python                            latest              3faf352bcef1   9 minutes ago   136MB
    
  3. ahora si pasamos a agregar la imagen con tag ya que esto es para que docker la use unicamente como lectura → docker tag app-python:latest marquitobb/app-python:latest

  4. y si hacemos docker images podemos vizualizar el tag que agregamos que va a ser la que se usuara

    app-python                            latest              3faf352bcef1   15 minutes ago   136MB
    marquitobb/app-python                 latest              3faf352bcef1   15 minutes ago   136MB
    
  5. despues de esto ya tenemos todo listo para subirla, solo para confirmar validamos si tenemos loggeada nuestra cuenta con docker login

  6. Una vez que si solo faltaria poder hacer push a nuestro repositorio con docker push marquitobb/app-python:latest

  7. Despues de esto si borramos la imagen con docker rmi marquitobb/app-python no tendriamos problemas de recuperarla ya que se quedo en el repo y solo necesitamos hacer docker pull marquitobb/app-python:latest para que de nuevo la descargue

Image of Datadog

Master Mobile Monitoring for iOS Apps

Monitor your app’s health with real-time insights into crash-free rates, start times, and more. Optimize performance and prevent user churn by addressing critical issues like app hangs, and ANRs. Learn how to keep your iOS app running smoothly across all devices by downloading this eBook.

Get The eBook

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️