Load data from host machine to docker hive container

I have a csv file in my host machine and I have a docker VM. I want to upload the data from the csv file in my host to the VM. I am using python‘s hive_service library to connect to and make queries. However, I am stuck as to how to put data into the VM.
For example the script below connects and is able to query hive but fails at the second query. I need to upload smpl.txt from my host machine to the docker vm

import sys

from hive_service import ThriftHive
from hive_service.ttypes import HiveServerException
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol

try:
  print "1111"
  transport = TSocket.TSocket("192.168.99.100", 10000)
  transport = TTransport.TBufferedTransport(transport)
  protocol = TBinaryProtocol.TBinaryProtocol(transport)
  print "2222"
  client = ThriftHive.Client(protocol)
  transport.open()
  print "3333"

  client.execute("CREATE TABLE names (name string, value int) ROW FORMAT DELIMITED FIELDS TERMINATED BY ','")
  client.execute("LOAD DATA LOCAL INPATH './smpl.txt' OVERWRITE INTO TABLE names")
  # client.execute("SELECT * FROM orders")
  # while (1):
  #   row = client.fetchOne()
  #   if (row == None):
  #     break
  #   print row

  #client.execute("SELECT * FROM r")
  # print client.fetchAll()
  print "4444"
  transport.close()
except Thrift.TException, tx:
  print '%s' % (tx.message)

  • How to use ipaddreses instead of container names in docker compse networking
  • /home/web/.gem/ruby/2.2.0/gems/redis-3.2.1/lib/redis/connection/ruby.rb:152:in `getaddrinfo': getaddrinfo: Name or service not known (SocketError)
  • Unable to access docker containers from host over macvlan network
  • Running docker container with my own privileges
  • Docker-Compose POSTGRES script only creates db not table
  • Boot2Docker to Google Compute Engine VM: saving Docker container
  • Docker Remote API with Weave
  • Quick way to add multiple RPM's to a dockerfile
  • docker instance of masterless salt showing folders of my system
  • Where does the convention of using /healthz for application health checks come from?
  • pthread_create failed: Resource temporarily unavailable on MongoDB
  • every time when i start a container with docker it gets a different IP
  • One Solution collect form web for “Load data from host machine to docker hive container”

    If that file must already be in the docker VM, you can consider using docker cp, which allows for copying a local file to a running container.

    Using a library like pypi/docker-py/, that would translate into:

    c = docker.Client(base_url='unix://var/run/docker.sock',
                      version='1.12', timeout=10)
    c.copy(container, resource)
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.