Skip to content

The repo is to record something about practicing using the docker

Notifications You must be signed in to change notification settings

MIBlue119/docker_practice

Repository files navigation

[Note] How to set a dockerfile for conda env?

Intro

This repo is a practice to construct a docker container to run conda env. Use differnet base image python & miniconda to build the service. The test function is about separating the audio with spleeter.

Ref

Material

  • 12345.mp3 : waited for separation
  • requirements.txt: spleeter version
  • test.py: script to operate sound separation

python.dockerfile

A dockerfile bases on python3.7 and installs the miniconda. Activate the conda env to run the test.py to use spleeter's audio separation.

Build the image

$docker build -f python.dockerfile -t conda_env_basedon_python .

Up the cotainer

$sudo docker run -it --name test_construct conda_env_basedon_python /bin/bash

if you want to rm the container after exit the container

sudo docker run --rm -it --name test_construct conda_env_basedon_python /bin/bash

miniconda.dockerfile

A dockerfile bases on miniconda image.

Build the image

$ docker build -f miniconda.dockerfile -t conda_env_basedon_mini .

Up the cotainer

$ sudo docker run -it --name test_construct_mini conda_env_basedon_mini /bin/bash

if you want to rm the container after exit the container

$ sudo docker run --rm -it --name test_cotest_construct_mini conda_env_basedon_mini /bin/bash

fastapi.dockerfile

This docker file is for test the fastapi service using.

Build the image

$ docker build -f fastapi.dockerfile -t test_fastapi_image .

Up the cotainer

$ sudo docker run -it --name test_fastapi_container test_fastapi_image /bin/bash

if you want to rm the container after exit the container

$ sudo docker run --rm -it --name test_fastapi_container test_fastapi_image /bin/bash

Other

  • Clean the builder cache of docker
$ docker builder prune 
  • Look the resource used at a container
$ sudo docker top 69cba92b5a44
  • Remove build cache
$ sudo docker builder prune
  • Monitor the resource that used by the container
$ sudo docker stats docker_container

圖片

About

The repo is to record something about practicing using the docker

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published