Skip to content

Instantly share code, notes, and snippets.

@zldrobit
Last active September 11, 2023 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zldrobit/29a7496ebbcf89463bd9dd508dfa03ea to your computer and use it in GitHub Desktop.
Save zldrobit/29a7496ebbcf89463bd9dd508dfa03ea to your computer and use it in GitHub Desktop.

install nvidia driver

sudo apt-get update
sudo apt-get install nvidia-384
sudo reboot

set gpu cards to persistent mode

sudo nvidia-persistenced --persistence-mode

Replace in /lib/systemd/system/nvidia-persistenced.service:

ExecStart=/usr/bin/nvidia-persistenced --user nvidia-persistenced --no-persistence-mode --verbose

with

ExecStart=/usr/bin/nvidia-persistenced --user nvidia-persistenced --persistence-mode --verbose

Restart nvidia-persistenced:

sudo systemctl daemon-reload
sudo systemctl restart nvidia-persistenced

follow docker installation instructions from

https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-ce and https://github.com/NVIDIA/nvidia-docker

docker post-installation

from https://docs.docker.com/install/linux/linux-postinstall/

pull tf docker image

sudo docker pull tensorflow/tensorflow:latest-gpu

pull tf serving image

sudo docker pull tensorflow/serving:latest-gpu

install pip

sudo apt-get install python-pip
sudo apt-get install python3-pip

install virtualenv

pip install virtualenv

create virtualenv environment

virtualenv .

install python package for tf-serving

pip install grpcio
pip install tensorflow-serving-api 

change docker storage directory

You can change Docker’s storage base directory (where container and images go) using the -g option when starting the Docker daemon.

Ubuntu/Debian: edit your /etc/default/docker file with the -g option: DOCKER_OPTS="-dns 8.8.8.8 -dns 8.8.4.4 -g /mnt"

Fedora/Centos: edit /etc/sysconfig/docker, and add the -g option in the other_args variable: ex. other_args="-g /var/lib/testdir". If there’s more than one option, make sure you enclose them in " ". After a restart, (service docker restart) Docker should use the new directory.

Using a symlink is another method to change image storage.

Caution - These steps depend on your current /var/lib/docker being an actual directory (not a symlink to another location).

Stop docker: service docker stop. Verify no docker process is running ps faux Double check docker really isn’t running. Take a look at the current docker directory: ls /var/lib/docker/

2b) Make a backup - tar -zcC /var/lib docker > /mnt/pd0/var_lib_docker-backup-$(date +%s).tar.gz

Move the /var/lib/docker directory to your new partition: mv /var/lib/docker /mnt/pd0/docker

Make a symlink: ln -s /mnt/pd0/docker /var/lib/docker

Take a peek at the directory structure to make sure it looks like it did before the mv: ls /var/lib/docker/ (note the trailing slash to resolve the symlink)

Start docker back up service docker start restart your containers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment